mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Considering namespaces while generating the routes. Closes #682
This commit is contained in:
parent
6bd65209d5
commit
42d002702c
2 changed files with 9 additions and 1 deletions
|
@ -10,7 +10,9 @@ module Devise
|
|||
hook_for :orm
|
||||
|
||||
def add_devise_routes
|
||||
route "devise_for :#{table_name}"
|
||||
devise_route = "devise_for :#{plural_name}"
|
||||
devise_route += %Q(, :class_name => "#{class_name}") if class_name.include?("::")
|
||||
route devise_route
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,12 @@ class DeviseGeneratorTest < Rails::Generators::TestCase
|
|||
assert_file "config/routes.rb", /devise_for :monsters/
|
||||
end
|
||||
|
||||
test "route generation for namespaced model names" do
|
||||
run_generator %w(monster/goblin name:string)
|
||||
match = /devise_for :goblins, :class_name => "Monster::Goblin"/
|
||||
assert_file "config/routes.rb", match
|
||||
end
|
||||
|
||||
def copy_routes
|
||||
routes = File.expand_path("../../rails_app/config/routes.rb", __FILE__)
|
||||
destination = File.join(destination_root, "config")
|
||||
|
|
Loading…
Add table
Reference in a new issue