This project is archived and is in readonly mode.
Route not resolving properly
-
mudboy
It's very easy to repeat this bug, and it only seems to effect the integration test.
step to reproduce.
$ rails appnamethen
$ script/generate scaffold Book title:string description:textrun the migration
$ rake db:migratemake a integration test
$ script/generate integration_test BookThen add the following to the test.
def test_truth id = books(:one).id post "/books/#{id}", :book => { :title => 'hello'} assert_response :success @@@@ -
Mike Weber
I don't believe this is a bug in Rails. The routing code is resolving to the only route that makes sense for a POST. But in a RESTful application, POSTs are only used for creating resources, which don't have an ID in the route. You'll need to use PUT in your test, rather than a POST.
-
mudboy
Thanks for your insight Mike, I have been tearing my hair out trying to work out why this wasn't working. It just stems from my not understanding how the RESTful routes work.
For future reference where is the best place to ask questions like this?
-
Michael Koziarski
elsif ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:database_manager] == CGI::Session::CookieStore && session.respond_to?(:dbman) && session.dbman.respond_to?(:generate_digest)Couldn't you just do:
if ActionController::Base.session_store == CGI::Session::CookieStoreOr is there a case where we're using the cookie store and don't have dbman respond_to
-
Mike Weber
The best resources for help with understanding Rails would either be the mailing list http://lists.rubyonrails.org/mai... or the #rubyonrails IRC channel on irc.freenode.net.
-
Tarmo Tänav
- State changed from new to invalid
- Tag changed from 2.1, actionpack, bug, routing to 2.1, actionpack, bug, routing
Looks like Michael actually intended to reply to #957 Generate form_authenticity_token correctly when using CookieStore and Secret ... :), closing this due to not being a bug.