Ruby on Rails - can't access datetime model object

Posted by NomadicRiley on Stack Overflow See other posts from Stack Overflow or by NomadicRiley
Published on 2010-06-17T17:03:22Z Indexed on 2010/06/17 19:03 UTC
Read the original article Hit count: 111

Filed under:

I've created a model that has 3 string columns and a datetime. Everything is running in SQLite3 and I can view the records in my table just fine using Lita.

I'm trying to display the values in a page (index action) using code like this:

<% @details.each do |lifeCycle| %> <%= debug(lifeCycle)%> <%= lifeCycle.lifeCycleId %> <%= lifeCycle.eventType %> <%= debug(lifeCycle.timeId) %> <% end %>

From the debug I get a result like this:

--- !ruby/object:LifeCycle attributes: eventType: Order created_at: "2111359287.23037" timeId: "2455364.89983796" eventId: "98765" updated_at: "2111359287.23037" lifeCycleId: "12345" id: "1" attributes_cache: {}

But whenever I try to access the event timeId - i' getting a nil value. This is true if i try to run debug on just that field debug(lifeCycle.timeId), or call a function on it.

Is there something obvious I'm missing here?

© Stack Overflow or respective owner

Related posts about ruby-on-rails