Querying
Queries
All
posts = Post.all("WHERE name LIKE ?", [%{Joe%}])
if posts
posts.each do |post|
puts post.name
end
end
# ORDER BY Example
posts = Post.all("ORDER BY created_at DESC")
# JOIN Example
posts = Post.all("JOIN comments c ON c.post_id = post.id
WHERE c.name = ?
ORDER BY post.created_at DESC",
["Joe"])First
Clearing
Find All
Find First
Find
Find By
Find in Batches
Find Each
Insert
Update
Delete
Last updated