I have two models
class User
has_one :entry
end
class Entry
belongs_to: user
end
in my controller I use find_each to iterate over entries to email each
of the users.
Entry.find_each(:include => :user, :conditions => {:approved =>
true}) do |entry|
UserMailer.send_competition_open_email(entry, entry.user)
end
entry.user is always nil..
yet i can see in my SQL logs it tries to get it. But fails. Any ideas?
Entry Load (0.6ms) SELECT `entries`.* FROM `entries` WHERE
`entries`.`approved` = 1 AND (`entries`.`id` >= 0) ORDER BY
`entries`.`id` ASC LIMIT 1000
User Load (1.4ms) SELECT `users`.* FROM `users` WHERE (`users`.`id`
IN (1,2,3))
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`id`
= 1 LIMIT 1
--
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.