Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fixes an issue with url generation for namespaced models #53

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.