Skip to content

Commit 4f376d6

Browse files
Merge pull request rails#53098 from seanpdoyle/authentication-generator-template-filenames
Rename authentication generator template files
2 parents 01e7c17 + 3d40291 commit 4f376d6

File tree

15 files changed

+22
-16
lines changed

15 files changed

+22
-16
lines changed

railties/lib/rails/generators/erb/authentication/authentication_generator.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module Erb # :nodoc:
66
module Generators # :nodoc:
77
class AuthenticationGenerator < Rails::Generators::Base # :nodoc:
88
def create_files
9-
template "views/passwords/new.html.erb", File.join("app/views/passwords/new.html.erb")
10-
template "views/passwords/edit.html.erb", File.join("app/views/passwords/edit.html.erb")
11-
template "views/sessions/new.html.erb", File.join("app/views/sessions/new.html.erb")
9+
template "app/views/passwords/new.html.erb"
10+
template "app/views/passwords/edit.html.erb"
11+
template "app/views/sessions/new.html.erb"
1212
end
1313
end
1414
end

railties/lib/rails/generators/rails/authentication/authentication_generator.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@ class AuthenticationGenerator < Base # :nodoc:
1111
end
1212

1313
def create_authentication_files
14-
template "models/session.rb", File.join("app/models/session.rb")
15-
template "models/user.rb", File.join("app/models/user.rb")
16-
template "models/current.rb", File.join("app/models/current.rb")
14+
template "app/models/session.rb"
15+
template "app/models/user.rb"
16+
template "app/models/current.rb"
1717

18-
template "controllers/sessions_controller.rb", File.join("app/controllers/sessions_controller.rb")
19-
template "controllers/concerns/authentication.rb", File.join("app/controllers/concerns/authentication.rb")
20-
template "controllers/passwords_controller.rb", File.join("app/controllers/passwords_controller.rb")
18+
template "app/controllers/sessions_controller.rb"
19+
template "app/controllers/concerns/authentication.rb"
20+
template "app/controllers/passwords_controller.rb"
2121

22-
template "mailers/passwords_mailer.rb", File.join("app/mailers/passwords_mailer.rb")
22+
template "app/mailers/passwords_mailer.rb"
2323

24-
template "views/passwords_mailer/reset.html.erb", File.join("app/views/passwords_mailer/reset.html.erb")
25-
template "views/passwords_mailer/reset.text.erb", File.join("app/views/passwords_mailer/reset.text.erb")
24+
template "app/views/passwords_mailer/reset.html.erb"
25+
template "app/views/passwords_mailer/reset.text.erb"
2626

27-
template "test/mailers/previews/passwords_mailer_preview.rb", File.join("test/mailers/previews/passwords_mailer_preview.rb")
27+
template "test/mailers/previews/passwords_mailer_preview.rb"
2828
end
2929

3030
def configure_application_controller
31-
gsub_file "app/controllers/application_controller.rb", /(class ApplicationController < ActionController::Base)/, "\\1\n include Authentication"
31+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Authentication\n"
3232
end
3333

3434
def configure_authentication_routes

0 commit comments

Comments
 (0)