Hello Railers,
I can''t get a mysql datetime format to be displayed in my list View.
In the Model, I declare this method :
--
def created_on
#created_on.to_s(:db)
#"to convert"
created_on.strftime("%A")
#created_on.to_time.strftime("%A")
#strptime(created_on,"%d/%m/%Y %H:%M:%S")
end
--
When I point my URL to the View, I get this :
--
Application error
Rails application failed to start properly"
--
I''am using Mac OS 10.4.2, MySQL 4.1.11-standard, and Apache.
All my records in the DB have a created_on date, so no record has a
null value for this field.
I''ve tried everything I''ve read, and nothing seems to work for
me.
Any suggestion?
Thanks in advance,
Thomas Balthazar.
Hello, I''ve found the answer. My error was that I was using a Helper in which I was generating sort links (for the column headers, in my list). While generating those links, I asked Rails to make an order_by on my created_on column. But since I change the return value of this column, I had an error. My solution was then to create a def created_on_formatted method, and to use the default def created_on for the sorting. Hum, I don''t know if it''s clear. Part of my mistake came from the fact that I was still railing at 3:00 am, knowing that I had to wake up at 8:30am to go to work. :o$ I''m doing my very first app in RoR, and I think last time I had this feeling that computer stuff can be gorgeous and fit your mind, it was when I bought my first Mac 3 years ago. Enjoy the day, Thomas. On 04 Sep 2005, at 08:48, Thomas Balthazar wrote:> Hello Railers, > > I can''t get a mysql datetime format to be displayed in my list View. > In the Model, I declare this method : > > -- > def created_on > #created_on.to_s(:db) > #"to convert" > created_on.strftime("%A") > #created_on.to_time.strftime("%A") > #strptime(created_on,"%d/%m/%Y %H:%M:%S") > end > -- > > When I point my URL to the View, I get this : > > -- > Application error > > Rails application failed to start properly" > -- > > I''am using Mac OS 10.4.2, MySQL 4.1.11-standard, and Apache. > All my records in the DB have a created_on date, so no record has a > null value for this field. > > I''ve tried everything I''ve read, and nothing seems to work for me. > Any suggestion? > > Thanks in advance, > Thomas Balthazar. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
def created_on
attributes[:created_on].strftime("%A")
end
Lucas Carlson
http://tech.rufy.com/
On Sep 3, 2005, at 11:48 PM, Thomas Balthazar wrote:
> Hello Railers,
>
> I can''t get a mysql datetime format to be displayed in my list
View.
> In the Model, I declare this method :
>
> --
> def created_on
> #created_on.to_s(:db)
> #"to convert"
> created_on.strftime("%A")
> #created_on.to_time.strftime("%A")
> #strptime(created_on,"%d/%m/%Y %H:%M:%S")
> end
> --
>
> When I point my URL to the View, I get this :
>
> --
> Application error
>
> Rails application failed to start properly"
> --
>
> I''am using Mac OS 10.4.2, MySQL 4.1.11-standard, and Apache.
> All my records in the DB have a created_on date, so no record has a
> null value for this field.
>
> I''ve tried everything I''ve read, and nothing seems to
work for me.
> Any suggestion?
>
> Thanks in advance,
> Thomas Balthazar.
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>