On 30 June 2010 19:00, Neil Bye <li...@ruby-forum.com> wrote: >> Neil Bye wrote: >>>> 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. > > Ar Chron wrote: >>, just pass the current story id as a parameter on the >> link_to, which makes that id available in the controller for your >> Story.find(params[:id]) or something close to that. > > I now have <%= link_to "Email this user", > :controller => "email", :action => "correspond", > :id => @user.login, :story_id => @story.id %> > > In the email_controller.rb I have > > story = Story.find(params[:story_id]) > > Is that what you meant and why does it not work?
What is the value of params[:story_id]? Look in the log. Colin -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.