I have been running through the essential training for Ruby on Rails
from Lynda. It is very helpful and I am learning a lot from it.
I am having a problem with Chapter 11 though, the CRUD and Relational
Databases section to be specific. When I generate the scaffold for
the albums, and try to edit an album with a release date earlier than
1970 I get a “1 error(s) on assignment of multiparameter attributes”
error. If i change the release date to 1970 or later, i get no error
and the record updates fine. The only way i know how to get around
this is to comment out the release date section of the edit form.
I am assuming that this problem isn’t specific to the Lynda training.
Does anyone have any suggestions?
You aren’t doing anything wrong. This is an issue that rears it’s
head from time to time.
Some platforms don’t handle dates outside the 1970-2038 range well.
Yours is most likely one of them. Rails’ ActiveRecord has to do the
job of converting what it receives via HTML form parameters into
something that your platform/database can stomach. It uses the Time
class to do that (because it’s faster) but can be told to use DateTime
instead. On most systems, it’s either not a problem or has been sorted
out, but there are a few systems that still cause peole grief.
(Microsoft / MS SQL are often the ones.)
There are official patches in the works (http://dev.rubyonrails.org/
ticket/3430) and also do-it-yourself work arounds (a Google search for
‘ActiveRecord DateTime 1970’ should find them).
My suggestion, assuming that you can’t switch computers or databases,
would be to input more recent dates while you continue the tutorial.
It’s not important for you to solve this problem in order to learn the
essentials of Rails. When you actually need dates before 1970 for an
application, you can try and see if it’s been solved “officially”,
switch platforms then, or investigate the DIY solutions out there.
Thank you so much for the links and insight. How about some plans for
another Lynda Ruby on Rails movie training set. Where do i go after
finishing the Lynda tutorials that you created?
jm
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.