To post a followup.  So the archive is here.

Seems the problem is when not doing mass assignment active record does the
date object creation.

This blog post
http://blog.springenwerk.com/2008/05/set-date-attribute-from-dateselect.htmlexplains
is much better than I can but lets say it solves it.

So updating a date or datetime field in a model from params yourself is not
easy but can be done with the above link

(thats for the search next time!)

Thanks to all that helped on this.

Jonathan Gill

On Wed, Aug 5, 2009 at 9:44 PM, Jonathan Gill <[email protected]>wrote:

> Many thanks for that!  Just what I needed to know.  I thought I tried that,
> but I guess I didnt.
>
> Along the same lines how about when Ive got a select_date on the form?  The
> data comes back in the params as
> {stuff => "something",
> order=> {"thedate(3i)" =>"2009",
> "thedate(2i)" => "10",
> "thedate(1i)" => "1"}}
>
> Ive tried
>
> param[:order][:thedate](3i)
> and
> params[:order][:thedate(3i)]
>
> and a load of other ways that are definately wrong!  Ive also looked
> through the ruby book and the agile ruby on rails book, but not sure what to
> look for so cant help myself here.
>
> Can someone point me in the right direction?
>
> Many thanks
>
> Jonathan Gill
>
>
> On Wed, Aug 5, 2009 at 8:54 PM, Ilan Berci <
> [email protected]> wrote:
>
>>
>> Jonathan Gill wrote:
>> >
>> > {"shape_name"=>"triangular",
>> >  "shape_code"=>"shape code is here",
>> >  "order"=>{"description"=>"this is a description"}}
>> >
>> > Can someone point out how I should be accessing the params so I can
>> > set the description of the shape?
>> >
>> > Many thanks
>> >
>> > Jonathan Gill
>>
>> @shape.description = params[:order][:description]
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to