title: Resource route in ruby and rails
body: <p>I have </p>
  
  <pre><code>resources :blog
  </code></pre>
  
  <p>declared in my <code>routes.rb</code> file but when I try to access <code>blog_path</code> in a controller or a <code>html.erb</code> file, I get the following error:</p>
  
  <pre><code>No route matches {:controller=&gt;"blog", :action=&gt;"show"} missing required keys: [:id]
  </code></pre>
  
  <p>I have created a controller called <code>BlogController</code> and defined the method <code>show</code> with a <code>show.html.erb</code> file in the views directory. If I define:</p>
  
  <p><code>match '/blog', to: 'blog#show', via: 'get'</code> instead, then <code>blog_path</code> works fine.</p>
  
  <p>My understanding is resources: <code>blog</code> is just syntactic sugar for <code>match '/blog', to: 'blog#show', via: 'get'</code> and a bunch of other routes. Please help.</p>