On 27 November 2011 06:15, Cynthia Kiser <c...@ugcs.caltech.edu> wrote: > Quoting Justin Ko <jko...@gmail.com>: >> Run "rake routes" and you'll see what the two "paths" generate. > > Rake routes didn't really give me much insight - but playing around in > the console did. Any argument to messages_path gets interpreted as a > format - even an integer. > > > app.messages_path(:pdf) > => "/messages.pdf" > > app.messages_path("doc") > => "/messages.doc" > > app.messages_path(1) > => "/messages.1" > > That hadn't occured to me - even once someone pointed out my > singular/plural problem. >
Because you were running a singular route the parameter you were passing was matching the :format part of the route. So what you were doing was telling the routing that instead of html you wanted your message (which resolves to the id of the message). So instead of xxx.html you are getting xxx.1 or whatever the id is. Rake routes tells you this: Singular resource - resource :users, :only => :show users GET /users(.:format) Plural resource - resources :users, :only => :show user GET /users/:id(.:format) # you can pass an id to this route You can see that with the singular resource passing an :id to the users_path makes no sense, as the route can't understand it. HTH Andrew > -- > Cynthia N. Kiser > c...@ugcs.caltech.edu > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- ------------------------ Andrew Premdas blog.andrew.premdas.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users