Class: TagAuth::Generators::ControllerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- TagAuth::Generators::ControllerGenerator
- Defined in:
- lib/generators/tag_auth/controller_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_routes ⇒ Object
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_controller ⇒ Object
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_initializer ⇒ Object
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 |