mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Automatically underscore and pluralize scoped views generator. Fixes #3790
This commit is contained in:
parent
9568e28d66
commit
005d514adf
1 changed files with 7 additions and 3 deletions
|
@ -47,7 +47,7 @@ module Devise
|
|||
def view_directory(name, _target_path = nil)
|
||||
directory name.to_s, _target_path || "#{target_path}/#{name}" do |content|
|
||||
if scope
|
||||
content.gsub "devise/shared/links", "#{scope}/shared/links"
|
||||
content.gsub "devise/shared/links", "#{plural_scope}/shared/links"
|
||||
else
|
||||
content
|
||||
end
|
||||
|
@ -55,7 +55,11 @@ module Devise
|
|||
end
|
||||
|
||||
def target_path
|
||||
@target_path ||= "app/views/#{scope || :devise}"
|
||||
@target_path ||= "app/views/#{plural_scope || :devise}"
|
||||
end
|
||||
|
||||
def plural_scope
|
||||
@plural_scope ||= scope.presence && scope.underscore.pluralize
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,7 +122,7 @@ module Devise
|
|||
end
|
||||
|
||||
def target_path
|
||||
"app/views/#{scope || :devise}/mailer"
|
||||
"app/views/#{plural_scope || :devise}/mailer"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue