# Datetime type raises error on assignment â€“ date type don't

**URL:** <https://www.ruby-forum.com/t/datetime-type-raises-error-on-assignment-a-date-type-dont/172645>\
**Category:** Rails\
**Created:** [July 24, 2009, 2:21pm UTC](https://www.ruby-forum.com/t/datetime-type-raises-error-on-assignment-a-date-type-dont/172645 "2009-07-24T14:21:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chobolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/48db29/32.png) [@chobolt](https://www.ruby-forum.com/u/chobolt)\
**Post date:** [July 24, 2009, 2:21pm UTC](https://www.ruby-forum.com/t/datetime-type-raises-error-on-assignment-a-date-type-dont/172645/1 "2009-07-24T14:21:29Z")

</div>

Hi everybody,

I have model with a datetime column named “end\_date”

I use a date\_select in a create view. A sample post request contains:  
{“project” =\> {“name”=\>“A project”, “end\_date(3i)”=\>“24”,  
“end\_date(1i)”=\>“2011”, “end\_date(2i)”=\>“2”}}

I get the following error:  
ActiveRecord::MultiparameterAssignmentErrors: 1 error(s) on assignment  
of multiparameter attributes

Running the console:

> > Project.new({“name”=\>“A project”, “end\_date(3i)”=\>“24”, “end\_date(1i)”=\>“2011”, “end\_date(2i)”=\>“2”})  
> > ActiveRecord::MultiparameterAssignmentErrors: 1 error(s) on assignment  
> > of multiparameter attributes  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/base.rb:3061:in  
> > `execute_callstack_for_multiparameter_attributes' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3022:in`assign\_multiparameter\_attributes’  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active\_record/base.rb:2749:in  
> > `attributes=' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:2439:in`initialize’  
> > from (irb):4:in `new’

> > Project.columns\_hash[“end\_date”]  
> > =\> #\<ActiveRecord::ConnectionAdapters::MysqlColumn:0xb6df14a0  
> > @type=:datetime, @precision=nil, @primary=false, @limit=nil,  
> > @default=nil, @null=true, @name=“end\_date”, @scale=nil,  
> > @sql\_type=“datetime”\>

Now, I change the column type from “datetime” to “date” and it works!

> > Project.new({“name”=\>“A project”, “end\_date(3i)”=\>“24”, “description”=\>"", “end\_date(1i)”=\>“2011”, “end\_date(2i)”=\>“2”})  
> > =\> #\<Project id: nil, name: “A project”, description: “”, created\_at:  
> > nil, updated\_at: nil, creator\_id: nil, updater\_id: nil, end\_date:  
> > “2011-02-24”\>

=\> #\<ActiveRecord::ConnectionAdapters::MysqlColumn:0xb6f3d4bc  
@type=:date, @precision=nil, @primary=false, @limit=nil, @default=nil,  
@null=true, @name=“end\_date”, @scale=nil, @sql\_type=“date”\>

Is that a bug with datetime type or I missed something?

Cheers,

Philippe
