How does :condtions of belongs_to/has_many work?


#1

If I put this in item.rb:

belongs_to :category, :conditions=>‘site_id=1’

It doesn’t appear to limit the categories to only those with site_id=1
(at least not with
form(‘item’) in a view). I also tried putting this in category.rb:

has_many :items, :conditions=>‘site_id=1’

And that doesn’t change anything. I even put non-existant field names in
the conditions clauses
and it doesn’t even cause an error. I also tried this in category.rb:

has_many :items, {:finder_sql=>‘select * from categories where
site_id=1’}

and that didn’t limit the categories either. belongs_to doesn’t have a
finder_sql option. Am I
missing something?

thanks
csn


Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/