On 3 October 2011 02:57, Rodrigo wrote:
I want to find all records in a model that contains the email
"john@test.com" despite the fact that the email value is within an
array of hashes. How do I do this?
You should probably change the array of hashes to an array of AR associations,
The email.rb model file says:

class Email < ActiveRecord::Base

has_many :from_addresses, :class => "EmailAddress"
has_many :to_addresses, :class => "EmailAddress"
has_many :cc_addresses, :class => "EmailAddress"

end
So that the EmailAddress model implements all the keys of your old
hashes as attributes, and you can then use regular finders.

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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 3, '11 at 1:57a
activeOct 3, '11 at 9:31a
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase