with this post; with a query with multiple tables, I am trying to return results that are null in one table; I am trying to do something like this; class NumbersFeedLink < ActiveRecord::Base has_many :numbers_sent_feed_link end class NumbersSentFeedLink < ActiveRecord::Base belongs_to :numbers_feed_link end sent = NumbersFeedLink.find(:all, :order => [ "created_on desc" ], :limit => @max_links_send, :conditions => [ "numbers_sent_feed_link == nil" ] ) -- Berlin Brown (ramaza3 on freenode) http://www.newspiritcompany.com http://www.newspiritcompany.com/newforums also checkout alpha version of botverse: http://www.newspiritcompany.com:8086/universe_home
On Apr 30, 2006, at 1:45 PM, Berlin Brown wrote:> with this post; with a query with multiple tables, I am trying to > return results that are null in one table; I am trying to do > something like this; > > class NumbersFeedLink < ActiveRecord::Base > has_many :numbers_sent_feed_link > end > > class NumbersSentFeedLink < ActiveRecord::Base > belongs_to :numbers_feed_link > end > > sent = NumbersFeedLink.find(:all, > :order => [ "created_on desc" ], > :limit => @max_links_send, > :conditions => [ "numbers_sent_feed_link == nil" ] > ) >The :conditions options accepts SQL that matches your database conventions. In PostgreSQL you could do: :conditions => [ ''numbers_sent_feed_link IS NULL'' ] Good luck! Cheers, Robby Robby Russell Founder & Executive Director PLANET ARGON, LLC Ruby on Rails Development, Consulting & Hosting www.planetargon.com www.robbyonrails.com +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4968 [fax]
Robby Russell wrote:> > In PostgreSQL you could do: > > :conditions => [ ''numbers_sent_feed_link IS NULL'' ] >It works in mysql too. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---