ruby - Padrino: how to send form data to app method -


i'm having trouble sending variables form post method sends emails. method receives variable names instead of content.

form

= form_tag url(:amenities, :email_booking, name: :name, email_addr: :email, message: :message), :method => 'post'    = flash_tag(:notice)   = field_set_tag     %p       = text_field_tag :name, :placeholder => "please enter name"     %p       = text_field_tag :email, :placeholder => "please enter email address",     %p       = text_area_tag :message, :placeholder => "message"    = field_set_tag(:class => 'buttons')     = submit_tag 'send message' 

controller

tourapart::app.controllers :amenities    post :email_booking, with: [:name, :email_addr, :message]      name = params[:name]     email_addr = params[:email_addr]     message = params[:message]      email       "bookings@example.com"       cc "customer@example.com"       email_addr       subject "we hope see soon"       locals :name => name, :message => message        body render('tour_booking_email')       content_type :plain     end     render "/"   end   end 

this (with template, not shown) generate , send email looks like

debug - sending email to: email bernardo.santos.83@gmail.com
date: fri, 27 jun 2014 09:48:12 +0100 from: bookings@example.com
to: email cc: customer@example.com message-id: <53ad2fcc7d2b7_eaaa3fe59362362c7528e@mk-xi.local.mail> subject: hope see mime-version: 1.0 content-type: text/plain;
charset=utf-8 content-transfer-encoding: 7bit

 dear name,  contact soon. thank interest in our services. recieved following message you:  "message"  please contact @ bookings@example.com if there add or clarify."   sincerely, 
puts params[:name]  

in controller return "name", i'm guessing post method not receiving data.

any ideas?

usually not use :with => kind of post form.

just use

# form.haml form_tag url(:amenities, :email_booking), :method => 'post'   ... 

and

tourapart::app.controllers :amenities   post :email_booking     name = params[:name]     email_addr = params[:email_addr]     message = params[:message]     ... 

(or skip passignments name => params[:name]alltogether, depends bit on want (also, validation). maybe sheds light on problem already.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -