I am doing michael hartl's tutorial for ruby on rails and everything works fine locally but not on heroku when the app deploys.. this problem dint arise before chapter 7 of this book: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#top
are there any details you need to debug this problem? please let me know.....
here are the heroku logs:
$ 2012-07-18T06:10:26+00:00 app[web.1]: 6: <ul class="nav pull-right">
2012-07-18T06:10:26+00:00 app[web.1]: ActionView::Template::Error (undefined met
hod `find_by_remember_token' for #<Class:0x00000004960740>):
2012-07-18T06:10:26+00:00 app[web.1]: 7: <li><%= link_to "Home", r
oot_path %></li>
2012-07-18T06:10:26+00:00 app[web.1]: 8: <li><%= link_to "Help", h
elp_path %></li>
2012-07-18T06:10:26+00:00 app[web.1]: 9: <% if signed_in? %>
2012-07-18T06:10:26+00:00 app[web.1]: 10: <li><%= link_to "Users
", users_path %></li>
2012-07-18T06:10:26+00:00 app[web.1]: 11: <li id="fat-menu" clas
s="dropdown">
2012-07-18T06:10:26+00:00 app[web.1]: 12: <a href="#" class="d
ropdown-toggle" data-toggle="dropdown">
2012-07-18T06:10:26+00:00 app[web.1]: app/helpers/sessions_helper.rb:10:in `cu
rrent_user'
2012-07-18T06:10:26+00:00 app[web.1]: app/helpers/sessions_helper.rb:23:in `si
gned_in?'
2012-07-18T06:10:26+00:00 app[web.1]: app/views/layouts/application.html.erb:1
1:in `_app_views_layouts_application_html_erb___2533055855927805914_43132200'
2012-07-18T06:10:26+00:00 app[web.1]: app/views/layouts/_header.html.erb:9:in
`_app_views_layouts__header_html_erb__2547305690965663969_41244280'
2012-07-18T06:10:26+00:00 app[web.1]:
2012-07-18T06:10:26+00:00 app[web.1]:
2012-07-18T06:10:26+00:00 heroku[router]: GET whizcollab.herokuapp.com/ dyno=web
.1 queue=0 wait=0ms service=345ms status=500 bytes=643
2012-07-18T06:10:34+00:00 app[web.1]:
2012-07-18T06:10:34+00:00 app[web.1]: Started GET "/" for 115.87.214.246 at 2012
-07-18 06:10:34 +0000
2012-07-18T06:10:34+00:00 app[web.1]:
2012-07-18T06:10:34+00:00 app[web.1]: Processing by StaticPagesController#home a
s HTML
2012-07-18T06:10:34+00:00 app[web.1]: Rendered static_pages/home.html.erb with
in layouts/application (0.6ms)
2012-07-18T06:10:34+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.0ms)
2012-07-18T06:10:34+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.2ms
)
2012-07-18T06:10:34+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2012-07-18T06:10:34+00:00 app[web.1]: ActionView::Template::Error (undefined met
hod `find_by_remember_token' for #<Class:0x00000004960740>):
2012-07-18T06:10:34+00:00 app[web.1]:
2012-07-18T06:10:34+00:00 app[web.1]: 8: <li><%= link_to "Help", h
elp_path %></li>
2012-07-18T06:10:34+00:00 app[web.1]: 9: <% if signed_in? %>
2012-07-18T06:10:34+00:00 app[web.1]: 6: <ul class="nav pull-right">
2012-07-18T06:10:34+00:00 app[web.1]: 10: <li><%= link_to "Users
", users_path %></li>
2012-07-18T06:10:34+00:00 app[web.1]: 7: <li><%= link_to "Home", r
oot_path %></li>
2012-07-18T06:10:34+00:00 app[web.1]: 11: <li id="fat-menu" clas
s="dropdown">
2012-07-18T06:10:34+00:00 app[web.1]: 12: <a href="#" class="d
ropdown-toggle" data-toggle="dropdown">
2012-07-18T06:10:34+00:00 app[web.1]: app/helpers/sessions_helper.rb:10:in `cu
rrent_user'
2012-07-18T06:10:34+00:00 app[web.1]: app/views/layouts/_header.html.erb:9:in
`_app_views_layouts__header_html_erb__2547305690965663969_41244280'
2012-07-18T06:10:34+00:00 app[web.1]: app/helpers/sessions_helper.rb:23:in `si
gned_in?'
2012-07-18T06:10:34+00:00 app[web.1]: app/views/layouts/application.html.erb:1
1:in `_app_views_layouts_application_html_erb___2533055855927805914_43132200'
2012-07-18T06:10:34+00:00 app[web.1]:
2012-07-18T06:10:34+00:00 app[web.1]:
2012-07-18T06:10:34+00:00 heroku[router]: GET whizcollab.herokuapp.com/ dyno=web
.1 queue=0 wait=0ms service=22ms status=500 bytes=643
2012-07-18T06:12:03+00:00 app[web.1]:
2012-07-18T06:12:03+00:00 app[web.1]:
2012-07-18T06:12:03+00:00 app[web.1]: Started GET "/" for 115.87.214.246 at 2012
-07-18 06:12:03 +0000
2012-07-18T06:12:03+00:00 app[web.1]: Processing by StaticPagesController#home a
s HTML
2012-07-18T06:12:03+00:00 app[web.1]: Rendered static_pages/home.html.erb with
in layouts/application (0.7ms)
2012-07-18T06:12:03+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.0ms)
2012-07-18T06:12:03+00:00 app[web.1]: Completed 500 Internal Server Error in 6ms
2012-07-18T06:12:03+00:00 app[web.1]: Rendered layouts/_header.html.erb (2.3ms
)
2012-07-18T06:12:03+00:00 app[web.1]: ActionView::Template::Error (undefined met
hod `find_by_remember_token' for #<Class:0x00000004960740>):
2012-07-18T06:12:03+00:00 app[web.1]:
2012-07-18T06:12:03+00:00 app[web.1]: 6: <ul class="nav pull-right">
2012-07-18T06:12:03+00:00 app[web.1]: 7: <li><%= link_to "Home", r
oot_path %></li>
2012-07-18T06:12:03+00:00 app[web.1]: 8: <li><%= link_to "Help", h
elp_path %></li>
2012-07-18T06:12:03+00:00 app[web.1]: 9: <% if signed_in? %>
2012-07-18T06:12:03+00:00 app[web.1]: 11: <li id="fat-menu" clas
s="dropdown">
2012-07-18T06:12:03+00:00 app[web.1]: 10: <li><%= link_to "Users
", users_path %></li>
2012-07-18T06:12:03+00:00 app[web.1]: 12: <a href="#" class="d
ropdown-toggle" data-toggle="dropdown">
2012-07-18T06:12:03+00:00 app[web.1]: app/helpers/sessions_helper.rb:10:in `cu
rrent_user'
2012-07-18T06:12:03+00:00 app[web.1]: app/helpers/sessions_helper.rb:23:in `si
gned_in?'
2012-07-18T06:12:03+00:00 app[web.1]: app/views/layouts/_header.html.erb:9:in
`_app_views_layouts__header_html_erb__2547305690965663969_41244280'
2012-07-18T06:12:03+00:00 app[web.1]: app/views/layouts/application.html.erb:1
1:in `_app_views_layouts_application_html_erb___2533055855927805914_43132200'
2012-07-18T06:12:03+00:00 app[web.1]:
2012-07-18T06:12:03+00:00 app[web.1]:
2012-07-18T06:12:03+00:00 heroku[router]: GET whizcollab.herokuapp.com/ dyno=web
.1 queue=0 wait=0ms service=17ms status=500 bytes=643
2012-07-18T06:13:31+00:00 app[web.1]:
2012-07-18T06:13:31+00:00 app[web.1]:
2012-07-18T06:13:31+00:00 app[web.1]: Started GET "/" for 115.87.214.246 at 2012
-07-18 06:13:31 +0000
2012-07-18T06:13:31+00:00 app[web.1]: Processing by StaticPagesController#home a
s HTML
2012-07-18T06:13:31+00:00 app[web.1]: Rendered static_pages/home.html.erb with
in layouts/application (0.4ms)
2012-07-18T06:13:31+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.0ms)
2012-07-18T06:13:31+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.9ms
)
2012-07-18T06:13:31+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2012-07-18T06:13:31+00:00 app[web.1]:
2012-07-18T06:13:31+00:00 app[web.1]: ActionView::Template::Error (undefined met
hod `find_by_remember_token' for #<Class:0x00000004960740>):
2012-07-18T06:13:31+00:00 app[web.1]: 6: <ul class="nav pull-right">
2012-07-18T06:13:31+00:00 app[web.1]: 7: <li><%= link_to "Home", r
oot_path %></li>
2012-07-18T06:13:31+00:00 app[web.1]: 9: <% if signed_in? %>
2012-07-18T06:13:31+00:00 app[web.1]: 11: <li id="fat-menu" clas
s="dropdown">
2012-07-18T06:13:31+00:00 app[web.1]: 10: <li><%= link_to "Users
", users_path %></li>
2012-07-18T06:13:31+00:00 app[web.1]: 8: <li><%= link_to "Help", h
elp_path %></li>
2012-07-18T06:13:31+00:00 app[web.1]: 12: <a href="#" class="d
ropdown-toggle" data-toggle="dropdown">
2012-07-18T06:13:31+00:00 app[web.1]: app/helpers/sessions_helper.rb:10:in `cu
rrent_user'
2012-07-18T06:13:31+00:00 app[web.1]: app/helpers/sessions_helper.rb:23:in `si
gned_in?'
2012-07-18T06:13:31+00:00 app[web.1]: app/views/layouts/application.html.erb:1
1:in `_app_views_layouts_application_html_erb___2533055855927805914_43132200'
2012-07-18T06:13:31+00:00 app[web.1]:
2012-07-18T06:13:31+00:00 app[web.1]: app/views/layouts/_header.html.erb:9:in
`_app_views_layouts__header_html_erb__2547305690965663969_41244280'
2012-07-18T06:13:31+00:00 app[web.1]:
2012-07-18T06:13:31+00:00 heroku[router]: GET whizcollab.herokuapp.com/ dyno=web
.1 queue=0 wait=0ms service=22ms status=500 bytes=643
2012-07-18T06:13:37+00:00 app[web.1]:
2012-07-18T06:13:37+00:00 app[web.1]:
2012-07-18T06:13:37+00:00 app[web.1]: Started GET "/users" for 115.87.214.246 at
2012-07-18 06:13:37 +0000
2012-07-18T06:13:37+00:00 heroku[router]: GET whizcollab.herokuapp.com/users dyn
o=web.1 queue=0 wait=0ms service=47ms status=500 bytes=643
2012-07-18T06:13:37+00:00 app[web.1]: Processing by UsersController#index as HTM
L
2012-07-18T06:13:37+00:00 app[web.1]: Completed 500 Internal Server Error in 1ms
2012-07-18T06:13:37+00:00 app[web.1]:
2012-07-18T06:13:37+00:00 app[web.1]: app/helpers/sessions_helper.rb:10:in `cu
rrent_user'
2012-07-18T06:13:37+00:00 app[web.1]: NoMethodError (undefined method `find_by_r
emember_token' for #<Class:0x00000004960740>):
2012-07-18T06:13:37+00:00 app[web.1]: app/helpers/sessions_helper.rb:23:in `si
gned_in?'
2012-07-18T06:13:37+00:00 app[web.1]: app/controllers/users_controller.rb:48:i
n `signed_in_user'
2012-07-18T06:13:37+00:00 app[web.1]:
2012-07-18T06:13:37+00:00 app[web.1]:
Heroku allows you to quickly deploy your Ruby on Rails application. Postgres database is easier to deploy in Heroku than other databases.
The Ruby standard library comes with a default web server named WEBrick.
So I was also doing the Hart Tutorial and was coming into the SAME issue. I ran the heroku run db:migrate....i made sure it was up to date with git push heroku....I added a remember_key to my one user in the database. It was in the schema.rb file.
I finally found the answer:
user.rb:
add :remember_token to attr_accessible
Ex: "attr_accessible :name, :email, :password, :password_confirmation, :remember_token"
For some reason this is left out of the tutorial, even though now that i know whats wrong it makes sense. After adding this I re-pushed to heroku and Viola....
Hope this helps :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With