Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Campaign::Event < Event
- belongs_to :campaign
- default_scope {}
- named_scope :not_nil, lambda { |col| { :conditions => [ "#{col} IS NOT NULL" ] } }
- end
- >> Campaign::Event.not_nil("id").all(:joins => :campaign)
- ActiveRecord::StatementInvalid: Mysql::Error: Column 'id' in where clause is ambiguous: SELECT `events`.* FROM `events` INNER JOIN `campaigns` ON `campaigns`.id = `events`.campaign_id WHERE (id IS NOT NULL)
Add Comment
Please, Sign In to add comment