Heroku Database not being read properly - ruby-on-rails

I am having trouble getting my Heroku app running. I want to import some data to my heroku database. I did this by running:
heroku pg:psql
\copy tablename FROM 'db/tableInfo.csv' DELIMITER ',' CSV;
then when I run:
select* from tablename
It prints out all the data I uploaded from the CSV, as desired.
However, when I go to my app and run "heroku open" my browser shows a page that says "We're sorry, but something went wrong." Then when I check the heroku logs, it says "PG::UndefinedTable: ERROR: relation "tablename" does not exist"
I am confused because when I go to the heroku site it says there are 3 rows (which I uploaded to tablename) and the "select * from tablename" after running heroku pg:psql displayed all the data that I wanted. Does anyone know why the relation isn't being recognized?
Thanks!
After running db:migrate I get this issue
EDIT: Here is the output from heroku logs (experimentInfo is the table name)
2016-03-15T05:33:16.813191+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:33:16.813192+00:00 app[web.1]: ^
2016-03-15T05:33:16.813193+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')
2016-03-15T05:33:16.813801+00:00 app[web.1]: Rendered main/experimentHome.html.erb within layouts/application (2.6ms)
2016-03-15T05:33:16.813872+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2016-03-15T05:33:16.816093+00:00 app[web.1]:
2016-03-15T05:33:16.816105+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:33:16.816123+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:33:16.816124+00:00 app[web.1]: ^
2016-03-15T05:33:16.816126+00:00 app[web.1]: 7: <%= #mexpMessage %>
2016-03-15T05:33:16.816125+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')):
2016-03-15T05:33:16.816127+00:00 app[web.1]: 8: <div class="alert alert-warning" style = "color:black" align = "left"><%= "To begin browsing the database, click on one of the experiments listed below. You can find information about each experiment listed in the blue boxes below each experiment link. To download the raw data for a given experiment, click the link next to the 'Click to download' field." %></div>
2016-03-15T05:33:16.816128+00:00 app[web.1]: 9: <h4> List of Experiments: </h4>
2016-03-15T05:33:16.816128+00:00 app[web.1]: 10: <% #experimentList.each do |e| %>
2016-03-15T05:33:16.816130+00:00 app[web.1]: 12: </a>
2016-03-15T05:33:16.816129+00:00 app[web.1]: 11: <%= link_to e.title, search_path(:selectexp => e.expId) %>
2016-03-15T05:33:16.816131+00:00 app[web.1]: 13: <div class="alert alert-info">
2016-03-15T05:33:16.816132+00:00 app[web.1]: app/views/main/experimentHome.html.erb:10:in `block in _app_views_main_experiment_ome_html_erb___1511755932124521423_70162519516940'
2016-03-15T05:33:16.816133+00:00 app[web.1]: app/views/main/experimentHome.html.erb:1:in `_app_views_main_experiment_ome_html_erb___1511755932124521423_70162519516940'
2016-03-15T05:33:16.816134+00:00 app[web.1]: app/controllers/main_controller.rb:6:in `experimentHome'
2016-03-15T05:33:16.816135+00:00 app[web.1]:
2016-03-15T05:33:16.816135+00:00 app[web.1]:
2016-03-15T05:33:16.805861+00:00 heroku[router]: at=info method=GET path="/" host=sheltered-beach-44318.herokuapp.com request_id=9b7cfa64-a230-4077-b676-96f407bda79a fwd="128.12.253.5" dyno=web.1 connect=1ms service=34ms status=500 bytes=1458
2016-03-15T05:38:27.339628+00:00 heroku[router]: at=info method=GET path="/" host=sheltered-beach-44318.herokuapp.com request_id=3a672911-5097-46ba-8920-7a307caeef2e fwd="128.12.253.5" dyno=web.1 connect=1ms service=32ms status=500 bytes=1458
2016-03-15T05:38:27.321501+00:00 app[web.1]: Started GET "/" for 128.12.253.5 at 2016-03-15 05:38:27 +0000
2016-03-15T05:38:27.343748+00:00 app[web.1]: Processing by MainController#experimentHome as HTML
2016-03-15T05:38:27.347286+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:38:27.347296+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:38:27.347298+00:00 app[web.1]: ^
2016-03-15T05:38:27.347299+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')
2016-03-15T05:38:27.348006+00:00 app[web.1]: Rendered main/experimentHome.html.erb within layouts/application (3.7ms)
2016-03-15T05:38:27.348212+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2016-03-15T05:38:27.350701+00:00 app[web.1]:
2016-03-15T05:38:27.350712+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:38:27.350712+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:38:27.350713+00:00 app[web.1]: ^
2016-03-15T05:38:27.350714+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')):
2016-03-15T05:38:27.350716+00:00 app[web.1]: 7: <%= #mexpMessage %>
2016-03-15T05:38:27.350718+00:00 app[web.1]: 8: <div class="alert alert-warning" style = "color:black" align = "left"><%= "To begin browsing the database, click on one of the experiments listed below. You can find information about each experiment listed in the blue boxes below each experiment link. To download the raw data for a given experiment, click the link next to the 'Click to download' field." %></div>
2016-03-15T05:38:27.350719+00:00 app[web.1]: 10: <% #experimentList.each do |e| %>
2016-03-15T05:38:27.350718+00:00 app[web.1]: 9: <h4> List of Experiments: </h4>
2016-03-15T05:38:27.350720+00:00 app[web.1]: 11: <%= link_to e.title, search_path(:selectexp => e.expId) %>
2016-03-15T05:38:27.350720+00:00 app[web.1]: 12: </a>
2016-03-15T05:38:27.350721+00:00 app[web.1]: 13: <div class="alert alert-info">
2016-03-15T05:38:27.350722+00:00 app[web.1]: app/views/main/experimentHome.html.erb:10:in `block in _app_views_main_experiment_ome_html_erb___1511755932124521423_70162519291600'
2016-03-15T05:38:27.350724+00:00 app[web.1]: app/views/main/experimentHome.html.erb:1:in `_app_views_main_experiment_ome_html_erb___1511755932124521423_70162519291600'
2016-03-15T05:38:27.350725+00:00 app[web.1]: app/controllers/main_controller.rb:6:in `experimentHome'
2016-03-15T05:38:27.350725+00:00 app[web.1]:
2016-03-15T05:38:27.350726+00:00 app[web.1]:
2016-03-15T05:49:37.158759+00:00 heroku[router]: at=info method=GET path="/" host=sheltered-beach-44318.herokuapp.com request_id=fe636ea4-c661-4ca3-b5b9-3b8e809f9a42 fwd="128.12.253.5" dyno=web.1 connect=2ms service=14ms status=500 bytes=1458
2016-03-15T05:49:37.157464+00:00 app[web.1]: Started GET "/" for 128.12.253.5 at 2016-03-15 05:49:37 +0000
2016-03-15T05:49:37.158827+00:00 app[web.1]: Processing by MainController#experimentHome as HTML
2016-03-15T05:49:37.162467+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:49:37.162475+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:49:37.162477+00:00 app[web.1]: ^
2016-03-15T05:49:37.162478+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')
2016-03-15T05:49:37.163383+00:00 app[web.1]: Rendered main/experimentHome.html.erb within layouts/application (3.6ms)
2016-03-15T05:49:37.163562+00:00 app[web.1]: Completed 500 Internal Server Error in 5ms
2016-03-15T05:49:37.166125+00:00 app[web.1]:
2016-03-15T05:49:37.166138+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:49:37.166139+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:49:37.166139+00:00 app[web.1]: ^
2016-03-15T05:49:37.166140+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')):
2016-03-15T05:49:37.166141+00:00 app[web.1]: 7: <%= #mexpMessage %>
2016-03-15T05:49:37.166144+00:00 app[web.1]: 9: <h4> List of Experiments: </h4>
2016-03-15T05:49:37.166160+00:00 app[web.1]: 10: <% #experimentList.each do |e| %>
2016-03-15T05:49:37.166161+00:00 app[web.1]: 11: <%= link_to e.title, search_path(:selectexp => e.expId) %>
2016-03-15T05:49:37.166161+00:00 app[web.1]: 12: </a>
2016-03-15T05:49:37.166144+00:00 app[web.1]: 8: <div class="alert alert-warning" style = "color:black" align = "left"><%= "To begin browsing the database, click on one of the experiments listed below. You can find information about each experiment listed in the blue boxes below each experiment link. To download the raw data for a given experiment, click the link next to the 'Click to download' field." %></div>
2016-03-15T05:49:37.166162+00:00 app[web.1]: 13: <div class="alert alert-info">
2016-03-15T05:49:37.166163+00:00 app[web.1]: app/views/main/experimentHome.html.erb:10:in `block in _app_views_main_experiment_ome_html_erb___1511755932124521423_70162519291600'
2016-03-15T05:49:37.166164+00:00 app[web.1]: app/views/main/experimentHome.html.erb:1:in `_app_views_main_experiment_ome_html_erb___1511755932124521423_70162519291600'
2016-03-15T05:49:37.166165+00:00 app[web.1]: app/controllers/main_controller.rb:6:in `experimentHome'
2016-03-15T05:49:37.166166+00:00 app[web.1]:
2016-03-15T05:49:37.166166+00:00 app[web.1]:
2016-03-15T05:51:40.692387+00:00 heroku[router]: at=info method=GET path="/" host=sheltered-beach-44318.herokuapp.com request_id=4867e943-7dab-40d9-8944-a030c8977e39 fwd="128.12.253.5" dyno=web.1 connect=0ms service=12ms status=500 bytes=1458
2016-03-15T05:51:40.699721+00:00 app[web.1]: Started GET "/" for 128.12.253.5 at 2016-03-15 05:51:40 +0000
2016-03-15T05:51:40.700884+00:00 app[web.1]: Processing by MainController#experimentHome as HTML
2016-03-15T05:51:40.706934+00:00 app[web.1]: PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:51:40.706951+00:00 app[web.1]: ^
2016-03-15T05:51:40.706942+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:51:40.707848+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms
2016-03-15T05:51:40.706953+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')
2016-03-15T05:51:40.710357+00:00 app[web.1]:
2016-03-15T05:51:40.707677+00:00 app[web.1]: Rendered main/experimentHome.html.erb within layouts/application (6.0ms)
2016-03-15T05:51:40.710386+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "experimentInfo" does not exist
2016-03-15T05:51:40.710387+00:00 app[web.1]: LINE 1: SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expI...
2016-03-15T05:51:40.710388+00:00 app[web.1]: ^
2016-03-15T05:51:40.710388+00:00 app[web.1]: : SELECT "experimentInfo".* FROM "experimentInfo" WHERE (expId != 'expId')):
2016-03-15T05:51:40.710389+00:00 app[web.1]: 7: <%= #mexpMessage %>
2016-03-15T05:51:40.710391+00:00 app[web.1]: 8: <div class="alert alert-warning" style = "color:black" align = "left"><%= "To begin browsing the database, click on one of the experiments listed below. You can find information about each experiment listed in the blue boxes below each experiment link. To download the raw data for a given experiment, click the link next to the 'Click to download' field." %></div>
2016-03-15T05:51:40.710392+00:00 app[web.1]: 9: <h4> List of Experiments: </h4>
2016-03-15T05:51:40.710393+00:00 app[web.1]: 10: <% #experimentList.each do |e| %>
2016-03-15T05:51:40.710393+00:00 app[web.1]: 11: <%= link_to e.title, search_path(:selectexp => e.expId) %>
2016-03-15T05:51:40.710394+00:00 app[web.1]: 12: </a>
2016-03-15T05:51:40.710395+00:00 app[web.1]: 13: <div class="alert alert-info">
2016-03-15T05:51:40.710396+00:00 app[web.1]: app/views/main/experimentHome.html.erb:10:in `block in _app_views_main_experiment_ome_html_erb___1511755932124521423_70162519516940'
2016-03-15T05:51:40.710397+00:00 app[web.1]: app/views/main/experimentHome.html.erb:1:in `_app_views_main_experiment_ome_html_erb___1511755932124521423_70162519516940'
2016-03-15T05:51:40.710399+00:00 app[web.1]:
2016-03-15T05:51:40.710398+00:00 app[web.1]: app/controllers/main_controller.rb:6:in `experimentHome'
2016-03-15T05:51:40.710400+00:00 app[web.1]:

Related

ActionView::Template::Error (v1_retired):

I have an old Rails Application which is working perfectly in development but once pushed to heroku, I get the error
ActionView::Template::Error (v1_retired):
Here's the link to the repo of the application.
Thanks for anybody's help in advance.
The error starts when I navigate to the posts path of the application.
Heroku logs show:
2017-10-15T06:15:40.681364+00:00 app[web.1]: Rendered posts/index.html.erb within layouts/application (242.1ms)
2017-10-15T06:15:40.684606+00:00 heroku[router]: at=info method=GET path="/posts" host=palmettostudios.herokuapp.com request_id=7cef0fd8-3df4-4eac-8236-499f871c4949 fwd="61.68.174.8" dyno=web.1 connect=1ms service=255ms status=500 bytes=1669 protocol=https
2017-10-15T06:15:40.682377+00:00 app[web.1]: Completed 500 Internal Server Error in 247ms (ActiveRecord: 8.3ms)
2017-10-15T06:15:40.683956+00:00 app[web.1]:
2017-10-15T06:15:40.683958+00:00 app[web.1]: ActionView::Template::Error (v1_retired):
2017-10-15T06:15:40.683959+00:00 app[web.1]: 27: <p><%= link_to 'Read Full Post', post_path(post), class:'pull-right btn btn-xs btn-link' %></p>
2017-10-15T06:15:40.683960+00:00 app[web.1]: 28: </div>
2017-10-15T06:15:40.683960+00:00 app[web.1]: 29: <div class='col-md-4 col-xs-12 post-image'>
2017-10-15T06:15:40.683961+00:00 app[web.1]: 30: <%= image_tag(post.image.url, class:'pull-right img img-responsive img-rounded') if post.image? %>
2017-10-15T06:15:40.683962+00:00 app[web.1]: 31: </div>
2017-10-15T06:15:40.683962+00:00 app[web.1]: 32: <% end %>
2017-10-15T06:15:40.683963+00:00 app[web.1]: 33: </div>
2017-10-15T06:15:40.683964+00:00 app[web.1]: app/views/posts/index.html.erb:30:in `block in _app_views_posts_index_html_erb___362288039534911980_70062267701880'
2017-10-15T06:15:40.683964+00:00 app[web.1]: app/views/posts/index.html.erb:21:in `_app_views_posts_index_html_erb___362288039534911980_70062267701880'
2017-10-15T06:15:40.683965+00:00 app[web.1]:
I just also ran into the same issue for an old Rails app of mine.
For me it was related to using the now deprecated gem paperclip-dropbox which relies on Dropbox's retired API v1.
Hope this information can be useful for everyone who comes here by searching for the non-descriptive error ActionView::Template::Error (v1_retired).

Issues with PG in heroku and model sort w.r.t the selected ids in rails

>----< means has_many_and_belongs_to in this post.
Let me start with the model and relationships:
events >-----< categories , events >-----< domains , events >-----< eligibles
I am sorting out the event data in a refresh_controller based on the selection made. Here is the code i'm using. It works perfectly fine with sqlite3. While in production, PG is causing some issues. When I have categories that are not linked to events and do a search it's throwing an error. Let me know if there is another way to do it.
Here is the controller.
def index
#cat = Category.find(params[:category][:category_id]) if params[:category][:category_id].present?
#dom = Domain.find(params[:domain][:domain_id]) if params[:domain][:domain_id].present?
#eli = Eligible.find(params[:eligible][:eligible_id]) if params[:eligible][:eligible_id].present?
#e_1=[]
#e_2=[]
#e_3=[]
#e_1 << #cat.events.collect{|p| p.id} if #cat.present?
#e_2 << #dom.events.collect{|p| p.id} if #dom.present?
#e_3 << #eli.events.collect{|p| p.id} if #eli.present?
#e_f = #e_1 | #e_2 | #e_3
#all = Event.where(id: #e_f)
#user = current_user || User.new
##event_ids || #events.collect{|p| p.id}
##event_ids = id_array.collect{|id| id.to_i}
end
index.html.erb:
<div class="container">
<b> <%= #cat.name if #cat.present? %> <%= #dom.name if #dom.present? %> <%= #eli.name if #eli.present? %></b>
<%= render partial: "static_pages/event", collection: #all %>
</div>
Here are my heroku logs:
heroku logs
2014-03-12T09:39:28.894581+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:170:in `select'
2014-03-12T09:39:28.894581+00:00 app[web.1]: [2014-03-12 09:39:28] FATAL SignalException: SIGTERM
2014-03-12T09:39:28.894581+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:160:in `start'
2014-03-12T09:39:28.894581+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:170:in `block in start'
2014-03-12T09:39:28.894581+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:32:in `start'
2014-03-12T09:39:28.894581+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
2014-03-12T09:39:28.894834+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-12T09:39:28.894834+00:00 app[web.1]: bin/rails:4:in `require'
2014-03-12T09:39:28.894834+00:00 app[web.1]: bin/rails:4:in `<main>'
2014-03-12T09:39:30.273961+00:00 heroku[web.1]: Process exited with status 143
2014-03-12T09:39:33.095928+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 5234 -e production`
2014-03-12T09:39:38.514112+00:00 app[web.1]: [2014-03-12 09:39:38] INFO WEBrick 1.3.1
2014-03-12T09:39:38.514112+00:00 app[web.1]: [2014-03-12 09:39:38] INFO ruby 2.1.0 (2013-12-25) [x86_64-linux]
2014-03-12T09:39:38.514323+00:00 app[web.1]: [2014-03-12 09:39:38] INFO WEBrick::HTTPServer#start: pid=2 port=5234
2014-03-12T09:39:41.211555+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
2014-03-12T09:39:41.702711+00:00 app[web.1]: [2014-03-12 09:39:41] FATAL SignalException: SIGTERM
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:170:in `select'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:32:in `start'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:170:in `block in start'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands/server.rb:84:in `start'
2014-03-12T09:39:41.702976+00:00 app[web.1]: [2014-03-12 09:39:41] INFO going to shutdown ...
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
2014-03-12T09:39:41.702976+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
2014-03-12T09:39:41.702976+00:00 app[web.1]: bin/rails:4:in `require'
2014-03-12T09:39:41.702976+00:00 app[web.1]: bin/rails:4:in `<main>'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:160:in `start'
2014-03-12T09:39:41.702711+00:00 app[web.1]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-03-12T09:39:41.702976+00:00 app[web.1]: => Rails 4.0.2 application starting in production on http://0.0.0.0:5234
2014-03-12T09:39:41.702976+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-03-12T09:39:41.702976+00:00 app[web.1]: => Booting WEBrick
2014-03-12T09:39:41.702976+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-03-12T09:39:41.702976+00:00 app[web.1]: Exiting
2014-03-12T09:39:41.702976+00:00 app[web.1]: [2014-03-12 09:39:41] INFO WEBrick::HTTPServer#start done.
2014-03-12T09:39:42.930276+00:00 heroku[web.1]: Process exited with status 143
2014-03-12T09:39:51.611779+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 53475 -e production`
2014-03-12T09:39:58.904726+00:00 app[web.1]: [2014-03-12 09:39:58] INFO WEBrick 1.3.1
2014-03-12T09:39:58.904726+00:00 app[web.1]: [2014-03-12 09:39:58] INFO ruby 2.1.0 (2013-12-25) [x86_64-linux]
2014-03-12T09:39:58.904963+00:00 app[web.1]: [2014-03-12 09:39:58] INFO WEBrick::HTTPServer#start: pid=2 port=53475
2014-03-12T09:39:59.295118+00:00 heroku[web.1]: State changed from starting to up
2014-03-12T09:40:00.368665+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-03-12T09:40:00.368665+00:00 app[web.1]: Started GET "/refresh?utf8=%E2%9C%93&category%5Bcategory_id%5D=&domain%5Bdomain_id%5D=&eligible%5Beligible_id%5D=4&commit=Search" for 122.167.180.66 at 2014-03-12 09:40:00 +0000
2014-03-12T09:40:00.368665+00:00 app[web.1]: => Booting WEBrick
2014-03-12T09:40:00.368665+00:00 app[web.1]: => Rails 4.0.2 application starting in production on http://0.0.0.0:53475
2014-03-12T09:40:00.368665+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-03-12T09:40:00.368665+00:00 app[web.1]: Started GET "/refresh?utf8=%E2%9C%93&category%5Bcategory_id%5D=&domain%5Bdomain_id%5D=&eligible%5Beligible_id%5D=4&commit=Search" for 122.167.180.66 at 2014-03-12 09:40:00 +0000
2014-03-12T09:40:00.493767+00:00 app[web.1]: Processing by RefreshController#index as HTML
2014-03-12T09:40:00.493767+00:00 app[web.1]: Processing by RefreshController#index as HTML
2014-03-12T09:40:00.531632+00:00 app[web.1]: User Load (2.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-03-12T09:40:00.565344+00:00 app[web.1]: Eligible Load (3.0ms) SELECT "eligibles".* FROM "eligibles" WHERE "eligibles"."id" = $1 LIMIT 1 [["id", "4"]]
2014-03-12T09:40:00.493974+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "category"=>{"category_id"=>""}, "domain"=>{"domain_id"=>""}, "eligible"=>{"eligible_id"=>"4"}, "commit"=>"Search"}
2014-03-12T09:40:00.493974+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "category"=>{"category_id"=>""}, "domain"=>{"domain_id"=>""}, "eligible"=>{"eligible_id"=>"4"}, "commit"=>"Search"}
2014-03-12T09:40:00.531632+00:00 app[web.1]: User Load (2.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
2014-03-12T09:40:00.565344+00:00 app[web.1]: Eligible Load (3.0ms) SELECT "eligibles".* FROM "eligibles" WHERE "eligibles"."id" = $1 LIMIT 1 [["id", "4"]]
2014-03-12T09:40:00.599548+00:00 app[web.1]: Event Load (1.6ms) SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.592159+00:00 app[web.1]: Event Load (5.2ms) SELECT "events".* FROM "events" INNER JOIN "eligibles_events" ON "events"."id" = "eligibles_events"."event_id" WHERE "eligibles_events"."eligible_id" = $1 [["eligible_id", 4]]
2014-03-12T09:40:00.599548+00:00 app[web.1]: Event Load (1.6ms) SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.599548+00:00 app[web.1]: LINE 1: SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.599548+00:00 a
pp[web.1]: : SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.599548+00:00 app[web.1]: ^
2014-03-12T09:40:00.599548+00:00 app[web.1]: : SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.600282+00:00 app[web.1]: Rendered refresh/index.html.erb within layouts/application (3.7ms)
2014-03-12T09:40:00.599548+00:00 app[web.1]: ^
2014-03-12T09:40:00.600282+00:00 app[web.1]: Rendered refresh/index.html.erb within layouts/application (3.7ms)
2014-03-12T09:40:00.599548+00:00 app[web.1]: PG::Error: ERROR: syntax error at or near ")"
2014-03-12T09:40:00.600424+00:00 app[web.1]: Completed 500 Internal Server Error in 106ms
2014-03-12T09:40:00.592159+00:00 app[web.1]: Event Load (5.2ms) SELECT "events".* FROM "events" INNER JOIN "eligibles_events" ON "events"."id" = "eligibles_events"."event_id" WHERE "eligibles_events"."eligible_id" = $1 [["eligible_id", 4]]
2014-03-12T09:40:00.599548+00:00 app[web.1]: LINE 1: SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.602492+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR: syntax error at or near ")"
2014-03-12T09:40:00.602492+00:00 app[web.1]: ^
2014-03-12T09:40:00.602492+00:00 app[web.1]: : SELECT "events".* FROM "events" WHERE "events"."id" IN ()):
2014-03-12T09:40:00.602492+00:00 app[web.1]: 2: <b> <%= #cat.name if #cat.present? %> <%= #dom.name if #dom.present? %> <%= #eli.name if #eli.present? %></b>
2014-03-12T09:40:00.602492+00:00 app[web.1]: 4:
2014-03-12T09:40:00.602492+00:00 app[web.1]: LINE 1: SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.602492+00:00 app[web.1]: 1: <div class="container">
2014-03-12T09:40:00.599548+00:00 app[web.1]: PG::Error: ERROR: syntax error at or near ")"
2014-03-12T09:40:00.602693+00:00 app[web.1]: 6: <script type="text/javascript" language="javascript" charset="utf-8">
2014-03-12T09:40:00.602693+00:00 app[web.1]: app/views/refresh/index.html.erb:3:in `_app_views_refresh_index_html_erb___3814188212292096351_70209931602340'
2014-03-12T09:40:00.602693+00:00 app[web.1]:
2014-03-12T09:40:00.602693+00:00 app[web.1]:
2014-03-12T09:40:00.602693+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR: syntax error at or near ")"
2014-03-12T09:40:00.602693+00:00 app[web.1]: ^
2014-03-12T09:40:00.600424+00:00 app[web.1]: Completed 500 Internal Server Error in 106ms
2014-03-12T09:40:00.602693+00:00 app[web.1]: 1: <div class="container">
2014-03-12T09:40:00.602881+00:00 app[web.1]: 2: <b> <%= #cat.name if #cat.present? %> <%= #dom.name if #dom.present? %> <%= #eli.name if #eli.present? %></b>
2014-03-12T09:40:00.602881+00:00 app[web.1]: 4:
2014-03-12T09:40:00.602881+00:00 app[web.1]:
2014-03-12T09:40:00.602693+00:00 app[web.1]: : SELECT "events".* FROM "events" WHERE "events"."id" IN ()):
2014-03-12T09:40:00.602492+00:00 app[web.1]: 3: <%= render partial: "static_pages/event", collection: #all %>
2014-03-12T09:40:00.602693+00:00 app[web.1]: LINE 1: SELECT "events".* FROM "events" WHERE "events"."id" IN ()
2014-03-12T09:40:00.602881+00:00 app[web.1]: 3: <%= render partial: "static_pages/event", collection: #all %>
2014-03-12T09:40:00.602881+00:00 app[web.1]: 5: </div>
2014-03-12T09:40:00.602693+00:00 app[web.1]:
2014-03-12T09:40:00.602881+00:00 app[web.1]: 6: <script type="text/javascript" language="javascript" charset="utf-8">
2014-03-12T09:40:00.602492+00:00 app[web.1]:
2014-03-12T09:40:00.602881+00:00 app[web.1]:
2014-03-12T09:40:00.602492+00:00 app[web.1]: 5: </div>
2014-03-12T09:40:00.602881+00:00 app[web.1]: app/views/refresh/index.html.erb:3:in `_app_views_refresh_index_html_erb___3814188212292096351_70209931602340'
2014-03-12T09:40:00.967239+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=floating-castle-4592.herokuapp.com request_id=d1fe2f58-7a19-42dc-9ef4-940d4841d822 fwd="122.167.180.66" dyno=web.1 connect=2ms service=7ms status=200 bytes=228
2014-03-12T09:40:00.609749+00:00 heroku[router]: at=info method=GET path=/refresh?utf8=%E2%9C%93&category%5Bcategory_id%5D=&domain%5Bdomain_id%5D=&eligible%5Beligible_id%5D=4&commit=Search host=floating-castle-4592.herokuapp.com request_id=578810a1-52fc-4d2a-a095-97a8983d926b fwd="122.167.180.66" dyno=web.1 connect=1ms service=243ms status=500 bytes=1543
Edits:
Also, I would like to know how to sort the events w.r.t to their popularity in the selection.
I think this is your problem:
#e_1 << #cat.events.collect{|p| p.id} if #cat.present?
#e_2 << #dom.events.collect{|p| p.id} if #dom.present?
#e_3 << #eli.events.collect{|p| p.id} if #eli.present?
#e_f = #e_1 | #e_2 | #e_3
#all = Event.where(id: #e_f)
In this case, if #e_1, #e_2 and #e_3 are all blank (nil) then #e_f is nil, then you do this
#all = Event.where(id: nil)
and i think that's what's causing your sql problem.
A much nicer way of doing what you want to do is this:
def index
#cat = Category.find(params[:category][:category_id]) if params[:category][:category_id].present?
#dom = Domain.find(params[:domain][:domain_id]) if params[:domain][:domain_id].present?
#eli = Eligible.find(params[:eligible][:eligible_id]) if params[:eligible][:eligible_id].present?
#all = Event.find([#cat, #dom, #eli].reject(&:blank?).collect(&:event_ids).flatten.uniq)
#user = current_user || User.new
end
I think this could be refactored further too, there's still a lot of repetition.
EDIT: you asked about ordering the results by most popular first. Here's one way, it's probably not the most efficient and almost certainly not the prettiest. It uses 'order by field(columname, values)` which is a way to specify an ordering in sql.
def index
#cat = Category.find(params[:category][:category_id]) if params[:category][:category_id].present?
#dom = Domain.find(params[:domain][:domain_id]) if params[:domain][:domain_id].present?
#eli = Eligible.find(params[:eligible][:eligible_id]) if params[:eligible][:eligible_id].present?
ids = [#cat, #dom, #eli].reject(&:blank?).collect(&:event_ids).flatten
sorted_ids = ids.sort_by{|id| ids.select{|id2| id2 == id}.size}.reverse
#all = Event.find(sorted_ids, :order => "field(id, #{sorted_ids.join(",")})" )
#user = current_user || User.new
end
This is the error:
ActionView::Template::Error (PG::Error: ERROR: syntax error at or near ")"
SELECT "events".* FROM "events" WHERE "events"."id" IN ())
We had a similar issue before -- it's basically that PGSql is not as forgiving as MYSQL or SQLite etc. I would say the best way to fix this is to refactor your code:
def index
cat = params[:category][:category_id]
domain = params[:domain][:domain_id]
eli = params[:eligible][:eligible_id]
queries = [cat, domain, eli]
queries.each_with_index do |query, i|
if query.present?
instance_variable_set("##{query}", Category.find(query))
e = instance_variable_get("##{query}")
instance_variable_set("#e_#{i}" = e.events.collect{|p| p.id}) if defined?(e)
end
end
#all = Event.where(id: [#e_1, #e_2, #e_3])
#user = current_user || User.new
end
This probably won't work at first, but with some fixing, I'm sure it will fix any of the issues you've been having

Rails project on Heroku: "We're sorry, but something went wrong"

I have just pushed a rails project to heroku, but I get the "We're sorry, but something went wrong."-error when I try to visit the web address. I did heroku run rake db:migrate just after I uploaded the project. Does someone know what the issue might be?
2013-07-07T03:18:40.493412+00:00 heroku[web.1]: State changed from starting to up
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Booting WEBrick
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:7276
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Call with -d to detach
2013-07-07T03:19:30.121757+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-07-07T03:19:30.121757+00:00 app[web.1]: Started GET "/" for 216.15.124.94 at 2013-07-07 03:19:30 +0000
2013-07-07T03:19:30.298842+00:00 app[web.1]: Processing by PagesController#lelist as HTML
2013-07-07T03:19:30.683128+00:00 app[web.1]: Completed 500 Internal Server Error in 384ms
2013-07-07T03:19:30.680391+00:00 app[web.1]: Rendered pages/_singlePost.html.erb (39.1ms)
2013-07-07T03:19:30.687518+00:00 app[web.1]: 1: <% #posts.each do |p| %>
2013-07-07T03:19:30.682956+00:00 app[web.1]: Rendered pages/lelist.html.erb within layouts/application (122.9ms)
2013-07-07T03:19:30.687518+00:00 app[web.1]: 3: <div class="span6 offset3">
2013-07-07T03:19:30.687741+00:00 app[web.1]: app/views/pages/_singlePost.html.erb:1:in `_app_views_pages__single_ost_html_erb___4229188597617574554_47615640'
2013-07-07T03:19:30.687741+00:00 app[web.1]:
2013-07-07T03:19:30.687518+00:00 app[web.1]: 4: <div class="thumbnail">
2013-07-07T03:19:30.687741+00:00 app[web.1]: app/views/pages/lelist.html.erb:22:in `_app_views_pages_lelist_html_erb___4165065758361537325_47142940'
2013-07-07T03:19:30.687518+00:00 app[web.1]: LINE 1: SELECT "posts".* FROM "posts" WHERE (DATETIME(created_at) ...
2013-07-07T03:19:30.687518+00:00 app[web.1]: : SELECT "posts".* FROM "posts" WHERE (DATETIME(created_at) <= DATETIME('2013-07-07 03:19:30.364173')) ORDER BY created_at DESC LIMIT 10 OFFSET 0):
2013-07-07T03:19:30.687518+00:00 app[web.1]: HINT: No function matches the given name and argument types. You might need to add explicit type casts.
2013-07-07T03:19:30.687741+00:00 app[web.1]:
2013-07-07T03:19:30.687518+00:00 app[web.1]:
2013-07-07T03:19:30.687518+00:00 app[web.1]: ActionView::Template::Error (PGError: ERROR: function datetime(timestamp without time zone) does not exist
2013-07-07T03:19:30.687518+00:00 app[web.1]: 2: <div class="row">
A little further down in the log I get another error:
2013-07-07T03:35:54.804738+00:00 app[web.1]: ActionView::Template::Error (PGError: ERROR: function datetime(timestamp without time zone) does not exist
2013-07-07T03:35:54.804738+00:00 app[web.1]: LINE 1: SELECT "posts".* FROM "posts" WHERE (DATETIME(created_at) ...
2013-07-07T03:35:54.804738+00:00 app[web.1]: ^
2013-07-07T03:35:54.804738+00:00 app[web.1]: HINT: No function matches the given name and argument types. You might need to add explicit type casts.
2013-07-07T03:35:54.804738+00:00 app[web.1]: : SELECT "posts".* FROM "posts" WHERE (DATETIME(created_at) <= DATETIME('2013-07-07 03:35:54.572183')) ORDER BY created_at DESC LIMIT 10 OFFSET 0):
2013-07-07T03:35:54.804738+00:00 app[web.1]: 1: <% #posts.each do |p| %>
2013-07-07T03:35:54.804738+00:00 app[web.1]: 4: <div class="thumbnail">
2013-07-07T03:35:54.804738+00:00 app[web.1]: 2: <div class="row">
2013-07-07T03:35:54.804738+00:00 app[web.1]: 3: <div class="span6 offset3">
2013-07-07T03:35:54.804934+00:00 app[web.1]: app/views/pages/_singlePost.html.erb:1:in `_app_views_pages__single_ost_html_erb___4229188597617574554_47615640'
2013-07-07T03:35:54.804934+00:00 app[web.1]: app/views/pages/lelist.html.erb:22:in `_app_views_pages_lelist_html_erb___4165065758361537325_47142940'
Heroku uses postgresql for your database. DATETIME is not a function postgres supports. You should set up a postgresql database of the same version in your development environment. What OS are you on? If windows, I wrote any answer for that (some of it is applicable even if you're running linux).

we're sorry, but something went wrong on heroku when a user tries signing up [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I can't correctly pinpoint what exactly is causing the issue
This is a new website I just pushed to heroku, ran heroku rake db:migrate, and heroku restart
It works just fine locally but this happens in production
Here's the relevant portion of heroku logs
2013-05-03T23:16:27.189569+00:00 app[web.1]:
2013-05-03T23:16:27.189569+00:00 app[web.1]: Started GET "/signup" for xx.xx.xx.
xxx at 2013-05-03 23:16:27 +0000
2013-05-03T23:16:27.253381+00:00 app[web.1]: Rendered shared/_error_messages.h
tml.erb (0.4ms)
2013-05-03T23:16:27.253381+00:00 app[web.1]: Rendered layouts/_shim.html.erb (
0.0ms)
2013-05-03T23:16:27.253381+00:00 app[web.1]: Rendered layouts/_header.html.erb
(2.9ms)
2013-05-03T23:16:27.253381+00:00 app[web.1]: Processing by UsersController#new a
s HTML
2013-05-03T23:16:27.253381+00:00 app[web.1]: Rendered users/new.html.erb withi
n layouts/application (43.8ms)
2013-05-03T23:16:27.253381+00:00 app[web.1]: Completed 200 OK in 60ms (Views: 48
.4ms | ActiveRecord: 1.6ms | Solr: 0.0ms)
2013-05-03T23:16:27.922135+00:00 heroku[router]: at=info method=GET path=/favico
n.ico host= sleepy-river-xxxx.herokuapp.com fwd="xx.xx.xx.xxx" dyno=web.1 connect
=1ms service=4ms status=304 bytes=0
2013-05-03T23:16:27.268937+00:00 heroku[router]: at=info method=GET path=/signup
host= sleepy-river-xxxx.herokuapp.com fwd="xx.xx.xx.xxx" dyno=web.1 connect=6ms
service=81ms status=304 bytes=0
2013-05-03T23:16:47.934099+00:00 app[web.1]:
2013-05-03T23:16:47.934099+00:00 app[web.1]:
2013-05-03T23:16:47.934099+00:00 app[web.1]: Started POST "/users" for xx.xx.xx.
xxx at 2013-05-03 23:16:47 +0000
2013-05-03T23:16:48.248989+00:00 app[web.1]: Redirected to http://sleepy-river-xxxx.herokuapp.com/home
2013-05-03T23:16:48.248989+00:00 app[web.1]: Parameters: {"utf8"=>"???", "auth
enticity_token"=>"m+NCbnqHJk81yWgyY+Y709mQZ0N04MpW8MLGLXjbleA=", "user"=>{"name"
=>"testuser", "email"=>"testuser#email.com", "password"=>"[FILTERED]", "passwo
rd_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
2013-05-03T23:16:48.248989+00:00 app[web.1]: Completed 302 Found in 311ms (Activ
eRecord: 70.6ms)
2013-05-03T23:16:48.248989+00:00 app[web.1]: Processing by UsersController#creat
e as HTML
2013-05-03T23:16:48.435265+00:00 app[web.1]:
2013-05-03T23:16:48.435265+00:00 app[web.1]:
2013-05-03T23:16:48.435265+00:00 app[web.1]: Started GET "/home" for 75.82.32.16
4 at 2013-05-03 23:16:48 +0000
2013-05-03T23:16:48.649331+00:00 app[web.1]: FROM pg_attribute a L
EFT JOIN pg_attrdef d
2013-05-03T23:16:48.649331+00:00 app[web.1]: WHERE a.attrelid = '"h
ashtags"'::regclass
2013-05-03T23:16:48.649331+00:00 app[web.1]: LINE 4: WHERE a.attrel
id = '"hashtags"'::regclass
2013-05-03T23:16:48.649331+00:00 app[web.1]: ON a.attrelid = d.a
drelid AND a.attnum = d.adnum
2013-05-03T23:16:48.649617+00:00 app[web.1]: 23: <%= link_to "#"+h.hashtag
s, "#" %><br>
2013-05-03T23:16:48.649617+00:00 app[web.1]: 25:
2013-05-03T23:16:48.649845+00:00 app[web.1]: Rendered shared/_user_info.html.e
rb (4.4ms)
2013-05-03T23:16:48.649331+00:00 app[web.1]: ActionView::Template::Error (PGErro
r: ERROR: relation "hashtags" does not exist
2013-05-03T23:16:48.649617+00:00 app[web.1]: 22: <% #htags.each do |h| %>
2013-05-03T23:16:48.649617+00:00 app[web.1]:
2013-05-03T23:16:48.649845+00:00 app[web.1]: Processing by StaticPagesController
#home as HTML
2013-05-03T23:16:48.649331+00:00 app[web.1]:
2013-05-03T23:16:48.649331+00:00 app[web.1]:
^
2013-05-03T23:16:48.649331+00:00 app[web.1]: : SELECT a.attname, for
mat_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2013-05-03T23:16:48.649617+00:00 app[web.1]: app/views/static_pages/home.html.
erb:22:in `_app_views_static_pages_home_html_erb___3097102804728997358_70437520'
2013-05-03T23:16:48.649845+00:00 app[web.1]:
2013-05-03T23:16:48.649331+00:00 app[web.1]: AND a.attnum > 0 AND
NOT a.attisdropped
2013-05-03T23:16:48.649331+00:00 app[web.1]: ORDER BY a.attnum
2013-05-03T23:16:48.649617+00:00 app[web.1]: 19: <div class="box">
2013-05-03T23:16:48.649617+00:00 app[web.1]: 24: <% end %>
2013-05-03T23:16:48.649617+00:00 app[web.1]: ):
2013-05-03T23:16:48.649617+00:00 app[web.1]: 20: Tagged Posts
2013-05-03T23:16:48.649617+00:00 app[web.1]: 21: <br>
2013-05-03T23:16:48.649845+00:00 app[web.1]: Rendered shared/_stats.html.erb (
38.9ms)
2013-05-03T23:16:48.649845+00:00 app[web.1]: Completed 500 Internal Server Error
in 209ms
2013-05-03T23:16:48.649845+00:00 app[web.1]: Rendered static_pages/home.html.e
rb within layouts/application (156.1ms)
2013-05-03T23:16:48.654562+00:00 heroku[router]: at=info method=GET path=/home h
ost=sleepy-river-xxxx.herokuapp.com fwd="xx.xx.xx.xxx" dyno=web.1 connect=1ms se
rvice=219ms status=500 bytes=643
2013-05-03T23:16:48.253053+00:00 heroku[router]: at=info method=POST path=/users
host= sleepy-river-xxxx.herokuapp.com fwd="xx.xx.xx.xxx" dyno=web.1 connect=3ms
service=395ms status=302 bytes=109
Something is wrong with the template that is loaded after a user signs up. Try it locally, I bet you'll find the answer you need.
Added hint:
Look at the line Relation HashTags does not exist. That holds the key to your problem.
I bet if you run
heroku run rake db:setup
and
heroku run rake db:migrate
Your problem will be solved

ActionView::Template::Error ( isn't precompiled):

In production (Heroku), I'm getting the following error:
Started GET "/articles/1" for 50.134.181.231 at 2012-06-17 00:37:35 +0000
2012-06-17T00:37:35+00:00 app[web.1]: ActionView::Template::Error ( isn't precompiled):
2012-06-17T00:37:35+00:00 heroku[router]: GET wandr.com/articles/1 dyno=web.1 queue=0 wait=0ms service=497ms status=500 bytes=728
2012-06-17T00:37:35+00:00 app[web.1]:
2012-06-17T00:37:35+00:00 app[web.1]: 74: = image_tag #article.featured_photo_url(:sm).to_s
2012-06-17T00:37:35+00:00 app[web.1]: 75:
2012-06-17T00:37:35+00:00 app[web.1]: 77: = image_tag #article.background_photo_url(:md).to_s
2012-06-17T00:37:35+00:00 app[web.1]: 76: %p
2012-06-17T00:37:35+00:00 app[web.1]: 78: %p
2012-06-17T00:37:35+00:00 app[web.1]: 79: = image_tag #article.cover_photo_url(:md).to_s
2012-06-17T00:37:35+00:00 app[web.1]: 80:
2012-06-17T00:37:35+00:00 app[web.1]: app/views/articles/show.html.haml:77:in `_app_views_articles_show_html_haml__1847247375488199378_48105500'
2012-06-17T00:37:35+00:00 app[web.1]:
2012-06-17T00:37:35+00:00 app[web.1]: app/controllers/articles_controller.rb:21:in `show'
2012-06-17T00:37:35+00:00 app[web.1]:
2012-06-17T00:37:35+00:00 app[web.1]: Processing by ArticlesController#show as HTML
2012-06-17T00:37:35+00:00 app[web.1]: Rendered articles/show.html.haml within layouts/admin (420.5ms)
2012-06-17T00:37:35+00:00 app[web.1]: Parameters: {"id"=>"1"}
2012-06-17T00:37:35+00:00 app[web.1]: Completed 500 Internal Server Error in 486ms
I'm running Rails 3.2.6, including actionpack 3.2.6 which I thought had this fix for this issue: https://github.com/rails/rails/commit/6bb86e1f3f7f9e11ee1c056d8742125173ecbce1
I also tried this: "ActionView::Template::Error ( isn't precompiled)" raised on "image_tag nil"
Basically, as long as one of the images on this page don't exist, it's throwing this error. If I upload the images, it works fine. Any ideas?
Thanks,
--Mark
I assume you're using something like CarrierWave to handle file uploads? You can specify a default image handler in your uploader class:
https://github.com/jnicklas/carrierwave#providing-a-default-url
class MyUploader < CarrierWave::Uploader::Base
def default_url
"/images/fallback/" + [version_name, "default.png"].compact.join('_')
end
end
This will output the default image rather than trying to access a non-existent file called "" in the asset pipeline.

Resources