Is there a way I could retrieve created_at value from the Database in Rails?
The table has columns like ticket_created, ticket_updated. By default a created_at column is also included. If I try doing:
@tickets = Ticket.find(:all)
for ticket in @tickets
puts ticket.created_at
end
the above code is returning ticket_created instead of the automatically generated created_at
The sample database row looks like this.
id | title | link | key | summary | priority | status | created_at | updated_at | ticket_created | ticket_updated
Try this to really put yourself at ease that the two columns contain different values.
Then try
t.created_at == t.ticket_createdto make sure they aren’t equal and then lastly, rename theticket_createdcolumn tosomething_elseand see if that does the trick.