Class: NestedScaffold::Generators::Model::TestUnitGenerator

Inherits:
TestUnit::Generators::ModelGenerator
  • Object
show all
Includes:
Base
Defined in:
lib/generators/test_unit/model_generator.rb

Instance Method Summary collapse

Constructor Details

#initializeTestUnitGenerator

Returns a new instance of TestUnitGenerator.



12
13
14
15
16
17
18
19
# File 'lib/generators/test_unit/model_generator.rb', line 12

def initialize(*)
  super

  unless attributes.map {|a| [a.name, a.type.to_s]}.include? [nested_parent_name, 'references']
    #DIRTY HACK add 'references' attribute
    attributes.insert 0, Rails::Generators::GeneratedAttribute.new(nested_parent_name, :references)
  end
end