Re: Saving dates

Stewart
2006-12-20T06:25:23Z

askegg wrote:
> That is the correct usage, but your controller is trying to pull the
> date submitted apart and force it into the database.
> Since the date fields are named with the database field name you can
> just use:
>
>   Exhibition.create(params[:details])
>
> instead of:
>
>   @exhibition.open_date = params[:details][:open_date]
>   @exhibition.save
>
> If you want some error checking, you might want to try something like:
>
>   @exhibition = Exhibition.new(params[:details])
>   if @exhibition.save
>     flash[:notice] = "Exhibition created"
>     redirect_to :action => :index and return

Thanks askegg that was it. Rails needs you to send all the data at once
and not set it 1 by 1 like i was. I was not fully understanding how that
all worked. Now i do and i cant see myself making the same mistake
again.

Thanks for all your help with the posts.