Let's say I have two models
class Client < ActiveRecord::Base
has_many :accounts
end
class Account < ActiveRecord::Base
belongs_to :client
end
Now, I want to have convenient method to access approved accounts(:approved => true). What is better to use, and why?
has_many: approved_accounts, -> { where :approved => true }
forClient
model
orscope: approved, -> { where :approved => true }
forAccount
model