Rails Activerecord Queries

 1# Simple queries return collections of instances
 2   Article.find(3) # id=3
 3   Article.w­her­e(a­uthor: 'admin')
 4   Article.where("likes_count = ?", value_for_count)
 5   Article.f­ind­_by­(title: 'Rails 4', author: 'admin')
 6   Article.find_or_create_by(title: 'Beatles')
 7
 8# Working with collections
 9   Article.where(author: 'pito').last # choosing
10   Article.where(author: 'pito').order(created_at: :desc) # sorting
11
12# Working with associated Models
13article = Article.comments.where(author: 'georg')
14