How would I go about finding an object in a collection? Specifically:
I have a collection called roles. I have a Role object with the name
property “user”. How do I find that object in roles?
How would I go about finding an object in a collection? Specifically:
I have a collection called roles. I have a Role object with the name
property “user”. How do I find that object in roles?
On 12/18/06, Pieter M. [email protected] wrote:
How would I go about finding an object in a collection? Specifically:
I have a collection called roles. I have a Role object with the name
property “user”. How do I find that object in roles?–
Posted via http://www.ruby-forum.com/.I believe you can use dynamic finders on AR collections.
@roles_collection.find_by_name( “user” )
whoops my appologies. I thought I was on the rails list…
Pieter M. wrote:
How would I go about finding an object in a collection? Specifically:
I have a collection called roles. I have a Role object with the name
property “user”. How do I find that object in roles?
ri Enumerable.find
Daniel ----- wrote:
On 12/18/06, Pieter M. [email protected] wrote:
How would I go about finding an object in a collection? Specifically:
I have a collection called roles. I have a Role object with the name
property “user”. How do I find that object in roles?–
Posted via http://www.ruby-forum.com/.I believe you can use dynamic finders on AR collections.
@roles_collection.find_by_name( “user” )
This worked great, thanks!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs