On 28 June 2010 11:37, Neil Bye <lists@ruby-forum.com> wrote:
> Michael Pavling wrote:
>
>>
>> :recipient => @story.user.email_address
>
> That gives undefined method `user' for nil:NilClass
Well then the "It won't accept @story.user because I don't know how to
make a relationship between the story model and the email model"
would've returned that error too!
If you have a Story object somewhere, and the story instance has a
user, and that user has an email address, you can pass it into your
ActionMailer method as a parameter (or, as it looks like you're doing,
a hash value). You can then set that passed-in email address as the
"recipients" for the email.
--
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.
No comments:
Post a Comment