[rspec-users] oddness with messages_path

Justin Ko jko170 at gmail.com
Sat Nov 26 22:33:48 EST 2011

On Nov 26, 2011, at 8:03 PM, Cynthia Kiser wrote:

> Quoting Patrick J. Collins <patrick at collinatorstudios.com>:
>>> I can work around it by constructing the url myself with
>>> "/messages/#{message.id}" but I am curious where the period is coming
>>> from in the constructed url. 
>> It's because you should be using a singular resource name to signify that you
>> are updating an existing record.  I believe you want to do
>> "message_path(message)" instead of "messages_path(message)"
> D'ho! Exactly right. I am still mystified by the way in which this
> fails but the problem is indeed that I needed to use
> message_path. That works with (message) and with (message.id). 

Run "rake routes" and you'll see what the two "paths" generate.

> And this is Rails 3.1.3 and rspec 2.7.0, rspec-core 2.7.1, and
> rspec-rails 2.7.0. 
> -- 
> Cynthia N. Kiser
> cnk at ugcs.caltech.edu
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list