Date issue for AS trunk version

14 views
Skip to first unread message

Open individual

unread,
Oct 4, 2007, 4:58:24 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hi everyone,

I just implemented the new bleeding edge trunk version.
Everything looked fine on the surface.

Now none of my dates can be sent to the DB uder both create and
update.

I get this error when I create or update

NoMethodError (undefined method `usec' for #<Date:
4908755/2,0,2299161>):
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:129:in
`quoted_date'
/vendor/plugins/dhtml_calendar/lib/extensions/active_record.rb:
42:in `quote'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:120:in `quote'


I am using PostgreSQL DB due avoid the sticky licensing issue of
MySQL.

It used to work with the AS plugin.

I have a date field called birthdate as defined in my migrate as date
type.

I need to use the trunk because I plan to get the DHTML pop up
calendar running again.

What is strange is that when I add a date to the DB directly then run
the Rails app and edit the customer I see the birthday displayed
correctly.

If I do not change anything and then click update I get the same
error.

Currently the date in the DB is shown like
2007-12-31
and when I used the pop up it is also shown like 2007-12-31

So I know it is not a date style problem.

Can anyone help me?


Thanks in advance
Uncle Mike

Open individual

unread,
Oct 4, 2007, 5:19:12 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
While going through the log file I found the following.


Processing CustomersController#create (for 127.0.0.1 at 2007-10-04
10:42:30) [POST]
Session ID: 3715b309d27a713eb4ea10e90b30c0f3
Parameters: {"commit"=>"Create", "action"=>"create",
"controller"=>"customers", "birthdate(1i)"=>"2007",
"lastname"=>"Soap", "firstname"=>"Joe", "birthdate(2i)"=>"10",
"birthdate(3i)"=>"4", "mobile"=>"", "fax"=>"123-122",
"town"=>"warawara", "telephone"=>"123-645",
"customer_status"=>{"id"=>"1"}, "email"=>"m...@mw.com"}}

Whats up with the birthdate being split up like that?

I only have one birthdate field in the DB called birthdate.

CCH

unread,
Oct 4, 2007, 5:38:28 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hi Uncle Mike

Why don't you make a copy of your project and then test it with dhtml.
I have a nasty suspicion that it is due to the Postgres Adapter.

If it is so, you could try to repost your question on Ruby on Rails :
Talk google group.

Open individual

unread,
Oct 4, 2007, 7:47:24 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hi everyone,

The problem is strange.

All I do is install the DHTML calendar and all my dates creates or
updates are then messed.

ruby script/plugin install http://dhtml-calendar.googlecode.com/svn/trunk

I change not a single thing and I get this error.
I change no includes or anything.

This is crazy.

Has anyone got this error.


Open individual

unread,
Oct 4, 2007, 7:51:00 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
What I basically found out is that the trunk version still works if
DHTML calendar is not is not present in the plugin folder.

EG standard date enrties go through to the DB but the minute I install
DHTML calendar the updates or new creations don't work.

Open individual

unread,
Oct 4, 2007, 8:44:10 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
This problem may be greater than I thought.

I tried this that is mentioned at the bottom of the following post.

http://dev.rubyonrails.org/ticket/8309

and it still does not work.

Is there anyone out there that uses PostgreSQL that has got the DHTML
calendar to work?

Open individual

unread,
Oct 4, 2007, 8:57:26 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hi everyone,

I hope Ed Moss is out there and may be knows what is causing this
problem.

If anyone has got this working on PostgreSQL please let me know.

Thanks
Uncle Mike

Ed Moss

unread,
Oct 4, 2007, 10:23:45 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hmmm. This sounds like our attempts to get DHTML Calendar to display
dates in a format different than the storage format may have caused
PostgreSQL some grief.

Open individual

unread,
Oct 4, 2007, 10:37:50 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Thanks Ed,

Currently the date in the DB is shown like
2007-12-31
and when I used the pop up it is also shown like 2007-12-31

This I presume is part of SQL insert as I see no INSERT command in the
log and this is above the error.

Processing CustomersController#create (for 127.0.0.1 at 2007-10-04
10:42:30) [POST]
Session ID: 3715b309d27a713eb4ea10e90b30c0f3
Parameters: {"commit"=>"Create", "action"=>"create",
"controller"=>"customers", "birthdate(1i)"=>"2007",
"lastname"=>"Soap", "firstname"=>"Joe", "birthdate(2i)"=>"10",
"birthdate(3i)"=>"4", "mobile"=>"", "fax"=>"123-122",
"town"=>"warawara", "telephone"=>"123-645",
"customer_status"=>{"id"=>"1"}, "email"=>"m...@mw.com"}}


This is the error in the log below that.


NoMethodError (undefined method `usec' for #<Date:
4908755/2,0,2299161>):
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:129:in
`quoted_date'
/vendor/plugins/dhtml_calendar/lib/extensions/active_record.rb:
42:in `quote'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:120:in
`quote'

I doubt that the official release v1.1 will have this problem fixed.

Thank you for getting back to me Ed.
I really appreciate it as I know you must be quite busy.

Regards
Uncle Mike

Big time AS fan

Open individual

unread,
Oct 4, 2007, 10:41:59 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Hi Ed,

Sorry I forgot to mention that what is so strange is the way the SQL
insert statement is built up.

It seams to break the date up.

"birthdate(1i)"=>"2007",
"lastname"=>"Soap", "firstname"=>"Joe", "birthdate(2i)"=>"10",
"birthdate(3i)"=>"4",

As shown above.

I really want to help you to get this working as I know how many
people are using PostGreSQL and ActiveScaffold.

Thanks for the assistance.

Uncle Mike

Open individual

unread,
Oct 4, 2007, 10:55:43 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Prehaps there is somewhere in the DHTML plugin where we can change the
way the date is built up for the SQL command.

I will look at it tonight again.

Thanks

Ed Moss

unread,
Oct 4, 2007, 11:53:26 AM10/4/07
to ActiveScaffold : Ruby on Rails plugin
I broke down and installed PostgreSQL. My suspicion was correct. I
backed out some changes so that DHTML Calendar will now work with
PostgreSQL.

Open individual

unread,
Oct 4, 2007, 2:59:31 PM10/4/07
to ActiveScaffold : Ruby on Rails plugin
Thank you so much Ed,

You solved it.
I downloaded the latest svn of DHTML calendar from
http://dry.4thebusiness.com/info/dhtml_calendar
It worked first time.

Unbelievable.

Thanks, thanks, thanks.

Magic stuff.

I am so glad you have joined the AS team.

Kind regards

Uncle Mike

Reply all
Reply to author
Forward
0 new messages