Rails: belongs_to with conditions/scope throwing syntax error
问题 I want to pick companies that are owned. I tried multiple combinations, new, rails 3, old school,... all of which are throwing the same syntax error unexpected '\n', expecting => belongs_to :from, class_name: 'Company', foreign_key: 'from_id', -> { where owned: true } belongs_to :from, class_name: 'Company', foreign_key: 'from_id', -> { where(owned: true) } belongs_to :from, class_name: 'Company', foreign_key: 'from_id', -> { where(:owned => true) } belongs_to :from, class_name: 'Company',