11175
(-- --)
September 17, 2009, 1:40pm
1
Amar Daxini wrote:
Aldo Italo wrote:
any idea?
Check your params[:contact] how it passes
check params period how it passed
or you can do this thing make setter method combine this hash 3 value
my errors:
/...../vendor/plugins/active_form/lib/active_form.rb:17:in
`instance_variable_set'
/...../vendor/plugins/active_form/lib/active_form.rb:17:in ` ='
/...../vendor/plugins/active_form/lib/active_form.rb:6:in `initialize'
/...../vendor/plugins/active_form/lib/active_form.rb:5:in `each'
/...../vendor/plugins/active_form/lib/active_form.rb:5:in `initialize'
/...../app/controllers/front/sections_controller.rb:60:in `new'
/...../app/controllers/front/sections_controller.rb:60:in `form_contact'
parameters:
{"contact"=>{"name"=>"",
"period(3i)"=>"17",
"info"=>"",
"phone"=>"",
"newsletter"=>"0",
"privacy"=>"0",
"surname"=>"",
"period(1i)"=>"2009",
"email"=>"",
"period(2i)"=>"9"},
"authenticity_token"=>"lWLs2p54kCr4Ymwj9DVBIvtmkdGtwZ/R8uvXZw8Sx14="}
Colin_Law1
(Colin Law)
September 17, 2009, 3:30pm
2
What type is the column period in the database?
Colin
Colin_Law1
(Colin Law)
September 17, 2009, 4:01pm
3
I'm out of my comfort zone in that case, I guess it is expecting
FormContact to have a DateTime field called period. I don't know how
you would handle that.
Colin
Sandy1
(Sandy)
September 18, 2009, 3:52am
4
First, you do not need a plug-in to get a date in a form. The fact
that you're using one, though, is irrelevant to the issue.
Next, look at the params hash which you're getting. It clearly has
the date as September 17, 2009, which is in the "period" hash as:
"period(3i)"=>"17",
"period(1i)"=>"2009",
"period(2i)"=>"9"
You have to understand that the "period" hash has three parts,
identified as period(1i), period(2i), and period(3i), representing the
year, month, and day, respectively.
Accordingly, if your controller included something like:
@p = params[:period]
you would then be able to identify the respective portions of the
date.
So, what's the problem?
Sandy
Tony
(Tony)
September 18, 2009, 2:26pm
5
If you are trying to mass assign an attribute that does not exist to
an instance of your model, you need to create a virtual attribute