When You Want To Pass A Condition To A Model From Dot Notati

I really don’t know if the subject made any sense! :slight_smile:

Basically I do the following

@user.tags.each do |tag|

end

Now I want to limit which tags associated to a user are returned. I
have a category associated with each tag. So for instance I just want
to a user’s tags which have a category = location. Can I do something
like that? :slight_smile:

Thanks for your help :-).


John K.
[email protected]

That makes perfect sense thanks. :slight_smile:

On 9/9/06, Tyler P. [email protected] wrote:

Now I want to limit which tags associated to a user are returned. I


John K.
[email protected]

If you are willing to take a db hit I’m pretty sure this will work.

@user.tags.find(:all, :conditions => [“category = ?”, location]).each do
|tag|

end

Hopefully that helps,
Tyler P.