On 22 April 2010 15:22, Tom Ha <[email protected]> wrote:
> ...how do I set the value 'params[:task][:enddate]' to 'nil' in the
> controller?
>
> I tried...
>
> params[:task][:enddate] = nil
>
> ...but that doesn't seem to "empty" the attribute 'enddate'. What am I
> getting wrong?
If it doesn't "empty" (whatever you mean by that) the :enddate entry,
what *does* it do?
I've just had a play in the console, and it all seems to work as expected:
>> params = {:task => {:enddate => Date.today.to_s}}
=> {:task=>{:enddate=>"2010-04-22"}}
>> params[:task][:enddate]
=> "2010-04-22"
>> params[:task][:enddate] = nil
=> nil
>> params
=> {:task=>{:enddate=>nil}}
>> params[:task][:enddate]
=> nil
--
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.