Re: Database saving empty records

Whiplash
Fri, 10 Jul 2009 15:46:33 -0000

Alright I figured out how to get it to work, but I''m still not sure
why.

First off, I was using the form_tag method of creating forms. Then in
my controller I was doing

@motorycle = Motorcycle.new(params[:motorcycle])
@motorcycle.save

This did not work. What I''ve done now is change the controller to:

@motorcycle= Motorcycle.new
@motorcycle.make = params[''make'']
@motorcycle.model = params[''model'']
@motorcycle.year = params[''year'']
@motorcycle.save

And that works!

So my question becoms, why do I have to manually assign the parameters
when using form_tag, and I don''t when using form_for?

Thanks

Dana