Hi all,
I really have a bad problem. I can’t make named resource paths to work.
If I use this:
def test_can_show
get :show, :party_id => @bob.id, :id => @address.id
assert_select
“#address_contact_route_#{@address.id}_line1_edit[url=?]”,
address_path(@bob, @address, :txt)
end
I get a big bang error:
- Error:
test_can_show(AddressContactRoutesControllerTest::PartyWithAddressTest):
NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.to_sym
/home/francois/src/xlsuite.org/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/core_ext/hash/keys.rb:27:in
symbolize_keys' /home/francois/src/xlsuite.org/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/inflector.rb:250:in
inject’
/home/francois/src/xlsuite.org/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
each' /home/francois/src/xlsuite.org/config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
inject’
/home/francois/src/xlsuite.org/config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/core_ext/hash/keys.rb:26:in
symbolize_keys' /home/francois/src/xlsuite.org/config/../vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:95:in
rewrite_path’
/home/francois/src/xlsuite.org/config/…/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:69:in
rewrite' /home/francois/src/xlsuite.org/config/../vendor/rails/actionpack/lib/action_controller/base.rb:522:in
url_for’
(eval):19:inaddress_path' /home/francois/src/xlsuite.org/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:451:in
send’
/home/francois/src/xlsuite.org/config/…/vendor/rails/actionpack/lib/action_controller/test_process.rb:451:in
method_missing' ./test/functional/address_contact_routes_controller_test.rb:47:in
test_can_show’
My route is properly defined in routes:
map.resources :parties, :path_prefix => “/admin” do |parties|
parties.resources :addresses, :controller => “address_contact_routes”
end
So, what’s my error ? Can anyone spot it ?
Thanks !
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/