Forum: Ruby on Rails ActiveResource and dates

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
jason (Guest)
on 2007-05-14 15:12
(Received via mailing list)
Hi
I'm having difficulty using form date_select on a date attribute when
using ActiveResource.

The xml attribute looks like:

<date type="date">yyyy-mm-dd</date>

And the form is simple form_for scaffolding:

form_for :model do |f|

f.date_select :date

end

When I run this I get the following error:

undefined method `day' for "2006-05-09":String

I think I have to do something with the attribute type but I'm unsure
exactly what and where.

Thx

Jason
jason (Guest)
on 2007-05-14 15:58
(Received via mailing list)
Solution

@model.date = Date.parse(@model.date)

in the client controller.
This topic is locked and can not be replied to.