Class: AuthRailsGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_allowed_tokens_strategyObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/generators/auth_rails_generator.rb', line 28

def create_allowed_tokens_strategy
  return if options[:strategy].blank? || options[:strategy] != 'allowed_token'

  invoke(
    'auth_rails:migration',
    [],
    strategy: 'allowed_token',
    model: (options[:model] || 'user').camelcase
  )
end

#generate_auth_railsObject



18
19
20
21
22
23
24
25
26
# File 'lib/generators/auth_rails_generator.rb', line 18

def generate_auth_rails
  @model = (options[:model] || 'user').camelcase
  @is_allowed_token = options[:strategy] == 'allowed_token'

  template(
    'auth_rails.tt',
    'config/initializers/auth_rails.rb'
  )
end