ruby on rails - Param is missing or the value is empty for: contact -


I have the following form validation for name and email:

  Valid: Name, Attendance: Correct Confirmation: Email, Attendance: True   

looks like this in my browser:

 Enter image details here

However, when I submit the following form:

  = contact_for simple_form_contact,: url = & Gt; Create_enquiry_path ,: method = & gt; : Post | Form | There are no errors on the page, but I am getting:    

>

  is absolute unavailable or the value is empty for: contact   

My administrator is:

  def create contact @contact = contactform. New (form_params) if @contact Err.Any? Render: Action = & gt; : New Flash [: Error] = 'Please fix errors.' Else redirect_to .... flash [: notice] = 'Thank you for your message, we will contact you soon!'   

Can someone please explain what I am doing wrong?

/ P>

It looks like you expect your parameters The comparison is different. If your parameter dictionary is coming like your controller:

  {: name = & gt; 'John' ,: Email = & gt; Then change your  form_params  method to:  
 <  

If your parameter dictionary is coming like your administrator:

   {: contact_form = & gt; {: Name = & gt; 'John' ,: Email = & gt; 'John.smith@abc.ca', ......}}   

Then change your form_params method (@ jÅ ?? ÃPospÃÅ Based on ¡IL suggestion):

  def form_params params.require (contact_form) .permit (: name, phone, email:, website) end    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -