You can use a book on Rails like the one from Pragmatic Programmers.
There are many nice features in the framework that need explanation
and you are missing out on what Rails has to offer by hack and slash
which constraints your thinking to the other frameworks you are used
to.
To answer your question, assuming the form is for the object of type
Message, you can do a xyz=Message.new(params[:message]) in your
controller and access the attribute normally.
On Sep 9, 2:59 pm, Paul Li <[EMAIL PROTECTED]> wrote:
> hi forum,
>
> I am new to rails, and i am just getting my hang of things.
>
> Problem,
> how do you pass content captured in a form to a custom method?
>
> I have the following form:
>
> <% form_for :message, @message, :url => { :action => 'reply'} do |f|
> %>
> <table cellpadding="4" cellspacing="5">
> <tr>
> <td>Content:<%= f.text_area :body %></td>
> <tr>
> <td><%= submit_tag "Send" %></td>
> </tr>
> </table>
> <% end %>
>
> this form is posting to a method called reply(), reply will need to take
>
> the :body from the message, so the incoming request parameters look like
> this:
>
> {"message"=>{"body"=>"this is the reply"},
> "commit"=>"Send",
> "authenticity_token"=>"e2a058071a4037d85008f46b35818e160f5230ce"}
>
> how do i retrieve "body"=>"this is the reply" from the request in the
> reply action?
>
> any tips are appreciated!
>
> ~zonman
> --
> Posted viahttp://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 [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
-~----------~----~----~----~------~----~------~--~---