Re: Database saving empty records

Frederick Cheung
Fri, 10 Jul 2009 15:59:56 -0000

On Jul 10, 4:46 pm, Whiplash
<danapelle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> @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?
>
Because form_for by default stuck your parameters in params
[:motorcycle], but the fields you created in the other case where at
the top level

Fred

> Thanks
>
> Dana