pirate694
pirate694

Reputation: 127

Rails cannot render created_at attribute of a record

This is so strange hence I can render every other part of the Message object BUT the datetime fields.... Heres is the offending code:

<h2><%= message.created_at.to_datetime.to_formatted_s(:long)%></h2>

It complains about no such method .datetime for Null.class. I tried rendering just message.created_at and there is nothing showing up. I have implemented this while back and it worked fine, any changes I have missed in Rails framework?

EDIT: Looked under my deployed app in active admin and all timestamps are gone like I cannot see them as well.

Upvotes: 0

Views: 63

Answers (1)

pirate694
pirate694

Reputation: 127

Well this line been breaking it all along.... (config/application.rb)

config.active_record.default_timezone = 'Eastern Time (US & Canada)'

I was trying to set timezone for time to display correctly but I guess that was not the way to go.

Upvotes: 1

Related Questions