Class: ControllerGenerator

Inherits:
Genosaurus
  • Object
show all
Defined in:
lib/mack/generators/controller_generator/controller_generator.rb

Overview

Generates a controller for Mack applications.

Example:

rake generate:controller name=post

Instance Method Summary collapse

Instance Method Details

#after_generateObject

:nodoc:



18
19
20
21
22
# File 'lib/mack/generators/controller_generator/controller_generator.rb', line 18

def after_generate # :nodoc:
  add_actions
  update_routes_file
  ControllerHelperGenerator.run(@options)
end

#setupObject

:nodoc:



9
10
11
12
13
14
15
16
# File 'lib/mack/generators/controller_generator/controller_generator.rb', line 9

def setup # :nodoc:
  @name_singular = param(:name).singular.underscore
  @name_plural = param(:name).plural.underscore
  @name_singular_camel = @name_singular.camelcase
  @name_plural_camel = @name_plural.camelcase
  @actions = []
  @actions = param(:actions).split(",") unless param(:actions).blank?
end