Welcome to Working With Rails

 

Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
How to pass form input to the controller
4 Posts
How to pass form input to the controller

thanks

in controller u can write

Assuming u have db called Booking n table name is booking and fields are name n email.Den

def create x=Booking.new x.name=params[:name] x.email=params[:email] x.save end

The passed input values will be in the params hash, keyed as such. params['name'] and params['email'] will retrieve the values.

At work I am currently developing this website on ruby on rails and I got stuck. I created a form, using html but now I want to pass the data entered in the form to the Controller to save it to the db. If I used rails to create the form I know how to pass the form input to the controller, but since i used html, I dont know how to. If i did my form this way:

How would I pass the two fields to the controller, assuming I have a database called “Booking”.

Thanks PS I looked at several tutorials but they only explain how to pass to the controller if you used rails to build the form.

4 Posts
Login to add your message