Give me NIL or null results


#1

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 B.
(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


#2

On Apr 30, 2006, at 1:45 PM, Berlin B. wrote:

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 R.
Founder & Executive Director

PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting


www.robbyonrails.com

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]


#3

Robby R. wrote:

In PostgreSQL you could do:

:conditions => [ ‘numbers_sent_feed_link IS NULL’ ]

It works in mysql too.