Class: RailsJwtAuth::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/rails_jwt_auth/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializer_fileObject



4
5
6
# File 'lib/generators/rails_jwt_auth/install_generator.rb', line 4

def create_initializer_file
  copy_file 'initializer.rb', 'config/initializers/rails_jwt_auth.rb'
end

#create_routesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/rails_jwt_auth/install_generator.rb', line 8

def create_routes
  route "resource :session, controller: 'rails_jwt_auth/sessions', only: [:create, :destroy]"
  route "resource :registration, controller: 'rails_jwt_auth/registrations', only: [:create]"
  route %q(
    resource :profile, controller: 'rails_jwt_auth/profiles', only: %i[show update] do
      collection do
        put :email
        put :password
      end
    end
  )

  route "resources :confirmations, controller: 'rails_jwt_auth/confirmations', only: [:create, :update]"
  route "resources :reset_passwords, controller: 'rails_jwt_auth/reset_passwords', only: [:show, :create, :update]"
  route "resources :invitations, controller: 'rails_jwt_auth/invitations', only: [:show, :create, :update]"
  route "resources :unlock_accounts, controller: 'rails_jwt_auth/unlock_accounts', only: %i[update]"
end