DateFields and ActiveRecords

Here is some typical code, right?

<% for column in User.visible_columns true %>

<%= column.human_name %> <%=h @user.send(column.name) %> <% end %>

I want to customize how the date is formatted for timestamps. How do I
do that? (I want the code above to automatically use my new format for
timestamp/datetime columns)

<% for column in User.visible_columns true %>

<%= column.human_name %> <%=h @user.send(column.name) %> <% end %>

I want to customize how the date is formatted for timestamps. How do I
do that? (I want the code above to automatically use my new format for
timestamp/datetime columns)

Try modifing the DATE_FORMATS[:db] constant with your own format…

you can see at:
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Conversions.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs