No route matches error but rake routes finds it, Rails.application.routes recognises it

Strangely when I include "resources :blogs" to my routes.rb I get the following error for any other path I try to reach:

No route matches {:action=>"show", :controller=>"blogs"}

The only path I don't get this error for is the "/blogs/:id(.:format)" itself.

Rake routes ("show" for "blogs" in line 5):

    blogs GET    /blogs(.:format)          blogs#index
          POST   /blogs(.:format)          blogs#create
 new_blog GET    /blogs/new(.:format)      blogs#new
edit_blog GET    /blogs/:id/edit(.:format) blogs#edit
     blog GET    /blogs/:id(.:format)      blogs#show
          PUT    /blogs/:id(.:format)      blogs#update
          DELETE /blogs/:id(.:format)      blogs#destroy
  root           /                         pages#home
     home        /home(.:format)           pages#home
 products        /products(.:format)       pages#products
 services        /services(.:format)       pages#services
 research        /research(.:format)       pages#research
                 /blog(.:format)           pages#blog
  contact        /contact(.:format)        pages#contact

On the other hand when tried in console there is no such error for "/products" (for instance) which in the browser returns the "No route matches" error:

1.9.3p327 :010 > Rails.application.routes.recognize_path "/products"
=> {:controller=>"pages", :action=>"products"} 
1.9.3p327 :011 > Rails.application.routes.recognize_path "/blogs/1"
=> {:action=>"show", :controller=>"blogs", :id=>"1"}

Any idea?


Here is my blogs_controller.rb:

class BlogsController < ApplicationController
  def show
    @blog = Blog.find(params[:id])

  def new

and my show.html.erb of the blogs:

<%= @blog.title %>, <%= @blog.description %>

So far this is all I have developed to test my Blog model.


Most likely, you have something like

<%= link_to "Blogs", blog_path =>

in layout template. If so, correct it to <%= link_to "Blogs", blogs_path =>

Regenerating the controller and model resolved the problem.

Need Your Help

Calling shell script using check_call


I am running into following error while calling shell script,how do I call shellscript using check_call or through anyother python function?

Prevent optimising jpeg on amazon s3

optimization amazon-web-services coldfusion amazon-s3

I am uploading files to amazon s3 using this coldfusion:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.