I am using time_zone_select for the first time:
<%= time_zone_select(''user'',
''default_timezone'') %>
I have an instance variable called user and that model has an attribute
called ''default_timezone''.
The list displays and when I submit the form, I see it sends the data:
Parameters:
{"user"=>{"auto_update_map"=>"1",
"default_timezone"=>"London"},
"device"=>{"81"=>{"nickname"=>"BonzoHunter"}},
"Submit"=>"Save Changes",
"action"=>"update_prefs",
"controller"=>"user"}
But, the UPDATE sets default_timezone to NULL:
UPDATE user_accounts SET "default_timezone" = NULL,
"auto_update_map" = 1
WHERE id = 27
Huh? The other attribute I set, ''auto_update_map'', works like
a charm and I
can see that the parameter was sent.
Simple code:
@user.default_timezone = params[:user][:default_timezone]
@user.auto_update_map = params[:user][:auto_update_map]
@user.save
So, what I am doing wrong here?
Thanks,
H
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---