Andy Jeffries wrote:
> On 29 June 2010 11:00, Neil Bye <lists@ruby-forum.com> wrote:
>
>> I have this bit of code in my email.controller
>>
>> user = @current_user
>> story = @current_story
>> recipient = story.user
>>
>> It doesn't work because @current_story isn't defined. How can I find the
>> current page to make this work?
>
>
> You haven't given anywhere enough detail for us to help you.
>
> @current_story - what are you expecting this variable to contain?
> Saying
> "the current page" won't help. Do you mean the current URL
> (@request.request_uri)? The current Page object (in which case you must
> have found the Page object using some code, assign that to
> @current_story.
> A variable from the session? @current_story = session[:current_story].
>
> We need a lot more information to be able to help. @current_story is an
> instance variable, but there's no information on what you're expecting
> it to
> magically contain.
>
> Cheers,
>
>
> Andy
The email is to be sent from a page containing a story and comments. I
want it to go to @story.user's email. If I use story=
Story.find_by_id(2) it works but I want an expression to find the
current story not one specified.
Does that tell you enough? Do you want more files sent?
Attachments:
http://www.ruby-forum.com/attachment/4823/email_controller.rb
--
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 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