Class: Trackman::ControllerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Trackman::ControllerGenerator
- Defined in:
- lib/generators/controller/controller_generator.rb
Constant Summary collapse
- @@actions =
['not_found', 'error', 'maintenance', 'maintenance_error']
- @@routes =
{'404' => 'not_found', '500' => 'error', '503' => 'maintenance', '503-error' => 'maintenance_error'}
Instance Method Summary collapse
Instance Method Details
#create_controller ⇒ Object
10 11 12 |
# File 'lib/generators/controller/controller_generator.rb', line 10 def create_controller template "controller_layout.rb.erb", "app/controllers/#{controller_name}_controller.rb" end |
#create_routes ⇒ Object
18 19 20 21 22 |
# File 'lib/generators/controller/controller_generator.rb', line 18 def create_routes @@routes.each do |k, v| route "match \"#{controller_name.camelize}/#{k}\", :to => \"#{controller_name}##{v}\"" end end |
#create_views ⇒ Object
14 15 16 |
# File 'lib/generators/controller/controller_generator.rb', line 14 def create_views create_views_for(:erb) end |