VocabReminder
Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Problem slash Bug in Rails with attr_accessor and Datetime Select Fields

       

Looks like there is a problem with using the attr_accessor method with datetime form fields http://dev.rubyonrails.org/ticket/8983 In Rails 2.3.2, for me at least, the problem seems to be popping up again. While trying to process a date for credit card validation, I keep getting a 'nil.klass' error. Sure enough, remove the datetime select from the form and the problem goes away. I need to look into this a little further because I think that this has been resolved.

More information is available here http://www.ruby-forum.com/topic/130229 and http://www.google.com/search?q=1+error(s)+on+assignment+of+multiparameter+attributes&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

The temporary solution is to not use attr_accessor and rather add the field to the database with the correct data type

 t.datetime :your_datetime_attribute_you_were_once_virtualizing
. Everything then works as normal. Oh well...

Tagged w/ #attr_accessor #bug #data type #datetime #validationsruby on rails