Frederick Cheung wrote:
>
> because with a date you can't pull the value from the params hash in
> one go like that - there is one value in the hash for each component
> (day, month, year). There's more about this at
> http://www.spacevatican.org/2008/12/3/dates-params-and-you
>
> Fred
I looked at this reference, but it seems to relate specifically to the
Rails date chooser, which I am not using. I dumped the hash contents
passed to the code thus:
print parm_hash.to_yaml
field_array.each do |f|
f = f.to_sym
model.send("#{f}=", "#{parm_hash[f]}") if
model.attribute_present?(f)
end
return model
This is what I get:
--- !map:HashWithIndifferentAccess
client_credit_limit: "250"
superseded_after__dteblk: ""
effective_from__dteblk: 2009-03-24 09:31:16 -0400
client_credit_status: INAC
client_credit_policy: OPEN
effective_from: 2009-03-24 09:31:16 -0400
superseded_after: ""
client_credit_terms: "15"
As far as I can tell from this there are no nested hashes of any type
and the value for 'effective_from is a datetime value.
This code should resolve to:
@client.send("effective_from=",2009-03-24 09:31:16 -0400)
And should be equivalent to:
@client.effective_from=params[:client][:effective_from]
Which works without error.
--
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
-~----------~----~----~----~------~----~------~--~---