Can someone tell me what is the equivalent way to do the following line in Rails 4?
has_many :friends, :through => :friendships, :conditions => \"statu
Needs to be the second arg:
class Customer < ActiveRecord::Base
has_many :orders, -> { where processed: true }
end
http://edgeguides.rubyonrails.org/association_basics.html#scopes-for-has-many
RESPONSE TO UPDATE:
Put the order inside the block:
has_many :friends, -> { where(friendship: {status: 'accepted'}).order('first_name DESC') }, :through => :friendships