Chris Drappier wrote in post #738922:
>
>> @page.parts.to_ary.find { |part| part.name = "some_name" }
>
>
> this should be @page.parts.to_ary.find{|part| part.name == "some_name"}
>
> the comparison operator is necessary for a find, if you use =, then you
> will set the attribute to the value.

I meet a same question,

User has_many Word has_many tag

I need the words has a tag 'fruit'.

I do this:

@User.word.find_all do | word |

  if word.tags.find_by_name('fruit')
    word.id
  end

end

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to