ruby on rails 3 - Extract just what is needed from params[:form] -


users can send reply feedback received. here form:

    <%= form_for :feedback, :url => reply_feedback_path |f| %>         <%= f.text_area :reply, :size => '66x7' %><br>         <%= f.submit "reply"  %>     <% end %> 

here controller:

@reply = params[:feedback] usermailer.reply2_comments(@to_whom, @from_whom, @reply).deliver 

if types in 'yo' text box, passed mailer ' {"reply"=>"yo"} '

i'm having trouble syntax extract content typed.

thanks.

it looks you're passing hash mailer, , want value key "reply". try:

@reply = params[:feedback] || {} usermailer.reply2_comments(@to_whom, @from_whom, @reply['reply']).deliver 

the main thing changed here changing @reply @reply['reply'] in mailer call

(i added nil-check first line make sure @reply['reply'] won't cause error if don't submit form normal means)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -