diff --git a/lib/generators/devise/views_generator.rb b/lib/generators/devise/views_generator.rb index b3a77397af..d5d831f1de 100644 --- a/lib/generators/devise/views_generator.rb +++ b/lib/generators/devise/views_generator.rb @@ -47,7 +47,7 @@ def copy_views 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 @@ def view_directory(name, _target_path = nil) 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 @@ def copy_views end def target_path - "app/views/#{scope || :devise}/mailer" + "app/views/#{plural_scope || :devise}/mailer" end end