Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes an issue with url generation for namespaced models

  • Loading branch information...
commit 4a5c55918c475bb42ad5d222c3273710719fae45 1 parent bc226c6
@tobscher tobscher authored
View
4 lib/responders/collection_responder.rb
@@ -21,10 +21,10 @@ def navigation_location
klass = resources.last.class
if klass.respond_to?(:model_name)
- resources[0...-1] << klass.model_name.plural.to_sym
+ resources[0...-1] << klass.model_name.route_key.to_sym
else
resources
end
end
end
-end
+end
View
12 test/collection_responder_test.rb
@@ -26,6 +26,10 @@ def only_symbols
def with_location
respond_with Address.new, :location => "given_location"
end
+
+ def isolated_namespace
+ respond_with MyEngine::Business.new
+ end
end
class CollectionResponderTest < ActionController::TestCase
@@ -59,4 +63,10 @@ def test_collection_respects_only_symbols
post :only_symbols
assert_redirected_to "admin_addresses_url"
end
-end
+
+ def test_collection_respects_isolated_namespace
+ @controller.expects(:businesses_url).returns("businesses_url")
+ post :isolated_namespace
+ assert_redirected_to "businesses_url"
+ end
+end
View
9 test/test_helper.rb
@@ -64,3 +64,12 @@ class Address < Model
class User < Model
end
+
+module MyEngine
+ def self.use_relative_model_naming?
+ true
+ end
+
+ class Business < Model
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.