title: Heroku Rails app throwing routing error for resource show action only in production
body: <p>I have a Rails 3.2 application hosted on Heroku, and after local development of a new blog resource it for some reason is running into issues when on my Heroku staging application by throwing an error that says </p>
  
  <pre><code> Started GET "/blog_posts" for 24.16.156.31 at 2014-09-16 01:27:59 +0000
     Rendered blog_posts/index.html.haml within layouts/application (25.9ms)
  
   ActionController::RoutingError (No route matches {:action=&gt;"show",  :controller=&gt;"blog_posts", :id=&gt;nil}):
   app/views/blog_posts/index.html.haml:89:in `_app_views_blog_posts_index_html_haml___3120682798112947929_70212833553560'
   app/controllers/blog_posts_controller.rb:10:in `index'
  </code></pre>
  
  <p>Yet when I run</p>
  
  <pre><code>heroku run rake routes
  </code></pre>
  
  <p>to display all available routes I can clearly see</p>
  
  <pre><code>                       blog_posts GET        /blog_posts(.:format)                                            blog_posts#index
                                    POST       /blog_posts(.:format)                                            blog_posts#create
                      new_blog_post GET        /blog_posts/new(.:format)                                        blog_posts#new
                     edit_blog_post GET        /blog_posts/:id/edit(.:format)                                   blog_posts#edit
                          blog_post GET        /blog_posts/:id(.:format)                                        blog_posts#show
                                    PUT        /blog_posts/:id(.:format)                                        blog_posts#update
                                    DELETE     /blog_posts/:id(.:format)                                        blog_posts#destroy
  </code></pre>
  
  <p>at the top of my routes.rb file I have</p>
  
  <pre><code>resources :blog_posts
  </code></pre>
  
  <p>The only thing I could think of was that when I inherited this project and went ahead to generate the scaffolding for a blog, it created the blog_post_controller of type</p>
  
  <pre><code>class BlogPostsController &lt; InheritedResources::Base
  </code></pre>
  
  <p>instead of the normal </p>
  
  <pre><code>class BlogPostsController &lt; ApplicationController
  </code></pre>
  
  <p>which has all the explicitly defined show, index, new, edit, etc, actions that you can alter.</p>
  
  <p>So to cause the scaffolding to return to ApplicationController I added to application.rb this line</p>
  
  <pre><code>config.app_generators.scaffold_controller = :scaffold_controller
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Edit:</p>
  
  <p>blog_posts_controller.rb show and index actions</p>
  
  <pre><code>def index
      @blog_posts = BlogPost.all
  
      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @blog_posts }
      end
    end
  
    # GET /blog_posts/1
    # GET /blog_posts/1.json
    def show
      @blog_post = BlogPost.find(params[:id])
      hash = session.exists?
      respond_to do |format|
        format.html # show.html.erb
        format.json { render json: @blog_post }
      end
    end
  </code></pre>
  
  <p>Additionally, the URL being accessed is </p>
  
  <pre><code>http://app.herokuapp.com/blog_posts
  </code></pre>
  
  <p>which should be triggering the index action, not show.</p>
  
  <p>When I attempt to hit blog_posts/1 where 1 is a valid blog_post id, I get </p>
  
  <pre><code>Parameters: {"id"=&gt;"1"}
  Rendered blog_posts/show.html.haml within layouts/application (31.9ms) 
  ActionController::RoutingError (No route matches {:action=&gt;"show", :controller=&gt;"blog_posts", :id=&gt;nil}):
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>resources :blog_posts
  </code></pre>