0

I'm trying to deploy my rails app on heroku, but I can't seem to have it recognize my databases/tables as even existing. For some reason, I seem to have translated the problem back locally as well, and now I get the following error:

ActionView::Template::Error (undefined method `strftime' for nil:NilClass):

When I try to execute this command:

<%= result.start_time.strftime("%a at %I:%M%p") %>

This worked previously. now I am trying to run it locally again and it isn't working.

I THINK the problem is that there is no database "results" being recognized, so we are trying to run strftime on a "nil" object. However, I have no clue how to get it to recognize the db, and have been fooling with it for hours. The development.sqlite db is still under the "/db/" folder, and rake db:reset doesn't seem to work. I use the SQLite database browser, and i can SEE the results table. It makes NO sense.

please help.

David

0

1 Answer 1

2

this particular problem is not about db.

Try this:

<%= result.start_time.strftime("%a at %I:%M%p") if result.start_time %>

It means that start_time field is blank. So results table presents, but particular field data doesn't exist.

Maybe, while you were transfering from sqlite3 to postgres DateTime fields weren't transfered succesfully.

Sign up to request clarification or add additional context in comments.

1 Comment

I'd agree with you, but once I got rid of the strftime statements completely, a new error poppped, up, saying "can't convert nil into String". This was because I tried to do "result.id.to_s" so this says to me that NOTHING was converted over.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.