Class: TagAuth::Generators::ControllerGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routesObject



24
25
26
# File 'lib/generators/tag_auth/controller_generator.rb', line 24

def add_routes
  route 'resources :tag_auth_tokens, only: [:index, :create]'
end

#create_controllerObject



15
16
17
18
19
20
21
22
# File 'lib/generators/tag_auth/controller_generator.rb', line 15

def create_controller
  @model = scope.camelize.singularize
  @instance = scope.downcase.singularize
  @scope = scope.blank? ? 'Users' : scope.camelize

  template 'tag_auth_controller.rb.erb',
           'app/controllers/tag_auth_tokens_controller.rb'
end

#create_initializerObject



28
29
30
31
# File 'lib/generators/tag_auth/controller_generator.rb', line 28

def create_initializer
  template 'tag_auth_initializer.rb',
           'config/initializers/tag_auth_initializer.rb'
end