all => ActiveRecord::Relation
Task.all.class.name
=> "ActiveRecord::Relation"
where.not
Task.where.not(title: "test")
# => Task Load (0.3ms) SELECT "tasks".* FROM "tasks" WHERE ("tasks"."title" != 'test')
where!
tasks = Task.order(:created_at); tasks.where!(title: "test")
# => Task Load (0.3ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."title" = 'test' ORDER BY "tasks"."created_at" ASC
複数カラムpluck
Task.where(id: 1).pluck(:title, :content, :count)
(0.2ms) SELECT "tasks"."title", "tasks"."content", "tasks"."count" FROM "tasks" WHERE "tasks"."id" = 1
# => [["テスト", "テストタスク", 1]]
update_attributes => update
Task.update_attributes(params[:user])
↓
Task.update(params[:task])
order => :asc/:desc
Task.order(created_at: :desc).all
# => SELECT "tasks".* FROM "tasks" ORDER BY "tasks"."created_at" DESC