Guest User

Untitled

a guest
Jul 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Campaign::Event < Event
  2. belongs_to :campaign
  3. default_scope {}
  4.  
  5. named_scope :not_nil, lambda { |col| { :conditions => [ "#{col} IS NOT NULL" ] } }
  6. end
  7.  
  8. >> Campaign::Event.not_nil("id").all(:joins => :campaign)
  9. 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