17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/generators/spree/storefront/devise/devise_generator.rb', line 17
def install
template 'user_sessions_controller.rb', 'app/controllers/spree/user_sessions_controller.rb'
template 'user_registrations_controller.rb', 'app/controllers/spree/user_registrations_controller.rb'
template 'user_passwords_controller.rb', 'app/controllers/spree/user_passwords_controller.rb'
insert_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
<<-ROUTES.strip_heredoc.indent!(2)
Spree::Core::Engine.add_routes do
# Storefront routes
scope '(:locale)', locale: /\#{Spree.available_locales.join('|')\}/, defaults: { locale: nil } do
devise_for(
Spree.user_class.model_name.singular_route_key,
class_name: Spree.user_class.to_s,
path: :user,
controllers: {
sessions: 'spree/user_sessions',
passwords: 'spree/user_passwords',
registrations: 'spree/user_registrations'
},
router_name: :spree
)
end
end
ROUTES
end
end
|