Class: Auth::Generators::ControllersGenerator
- Inherits:
-
Rails::Generator::NamedBase
- Object
- Rails::Generator::NamedBase
- Auth::Generators::ControllersGenerator
- Defined in:
- lib/auth/generators/controllers_generator.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model, options = {}) ⇒ ControllersGenerator
constructor
A new instance of ControllersGenerator.
- #manifest ⇒ Object
- #spec ⇒ Object
Constructor Details
#initialize(model, options = {}) ⇒ ControllersGenerator
Returns a new instance of ControllersGenerator.
4 5 6 7 8 |
# File 'lib/auth/generators/controllers_generator.rb', line 4 def initialize(model, = {}) @model = model args = [ model.name ] super(args, ) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
2 3 4 |
# File 'lib/auth/generators/controllers_generator.rb', line 2 def model @model end |
Instance Method Details
#manifest ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/auth/generators/controllers_generator.rb', line 10 def manifest record do |m| m.directory "app/controllers" m.directory "app/helpers" m.template "accounts_controller.rb", File.join("app/controllers", "#{model.accounts_controller.underscore}_controller.rb"), :assigns => { :model => model } m.template "sessions_controller.rb", File.join("app/controllers", "#{model.sessions_controller.underscore}_controller.rb"), :assigns => { :model => model } m.template "accounts_helper.rb", File.join("app/helpers", "#{model.accounts_controller.underscore}_helper.rb"), :assigns => { :model => model } m.template "sessions_helper.rb", File.join("app/helpers", "#{model.sessions_controller.underscore}_helper.rb"), :assigns => { :model => model } # Controller generator should also kick off the corresponding view generation. views = Auth::Generators::ViewsGenerator.new(model, :source => File.join(source_root), :destination => destination_root) views.manifest.replay(m) end end |