[Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread Andreas Schmidt
Hello radhmes brito, here both traces for the errors. For comment.created_at.strftime(%Y.%m.%d): undefined method `strftime' for nil:NilClass activesupport (3.0.0) lib/active_support/whiny_nil.rb:48:in `method_missing' app/views/products/show.html.erb:64:in

Re: [Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread radhames brito
put this comment.try(:created_at) and tel me what happens i want to see if it really is nil On Sun, Sep 12, 2010 at 7:23 AM, Andreas Schmidt railsa...@googlemail.comwrote: Hello radhmes brito, here both traces for the errors. For comment.created_at.strftime(%Y.%m.%d): undefined method

[Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread Andreas Schmidt
so i did ut comment.try(:created_at) into the view, it outputs: 2010-09-11 03:18:46 +0200. So i think it cant be nil ... On 12 Sep., 19:56, radhames brito rbri...@gmail.com wrote: put this comment.try(:created_at) and tel me what happens i want to see if it really is nil -- You

Re: [Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread radhames brito
this is weird try using i18n to format it. copy a file from github put it in the locale folder uncomment the set locale configuration then put an L function in front of it like this l(comment.created_at) On Sun, Sep 12, 2010 at 2:28 PM, Andreas Schmidt railsa...@googlemail.comwrote: so i did

[Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread Andreas Schmidt
So i fixed it finally ! It was my fault ..what else should have happened :( In my controller i had a @product.comments.build. So in the each he tried to iterate over that object also ... but it is empty. Thanks for you help anyway! -- You received this message because you are subscribed to the

Re: [Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-12 Thread radhames brito
uff , great it working On Sun, Sep 12, 2010 at 3:05 PM, Andreas Schmidt railsa...@googlemail.comwrote: So i fixed it finally ! It was my fault ..what else should have happened :( In my controller i had a @product.comments.build. So in the each he tried to iterate over that object also ...

[Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread Andreas Schmidt
Hello radhmes brito, as you can see here: http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html it is possible to output a formatted like i tried. You can simply set it up in /config/initializeres/time_formats.rb like this: Time::DATE_FORMATS.merge!( :mydate = '%d.%m.%Y' ) Then

Re: [Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread radhames brito
i once used something like to_s(:mydate) but it never worked so i always go for the sure thing. can you show the stack for both errors? On Sat, Sep 11, 2010 at 3:37 PM, Andreas Schmidt railsa...@googlemail.comwrote: Hello radhmes brito, as you can see here: