Class: CrailsDestroyPreparator
- Inherits:
-
GeneratorBase
- Object
- GeneratorBase
- CrailsDestroyPreparator
- Defined in:
- lib/metarecord/generators/crails/destroy_generator.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #has_many(type, name, options = {}) ⇒ Object
- #has_one(type, name, options = {}) ⇒ Object
- #prepare ⇒ Object
Methods inherited from GeneratorBase
#_append, _use_by_files, _use_by_models, #get_classname, #get_pluralized_name, #get_singular_name, #get_type, #get_value, #id_type, #indent, is_file_based?, #make_block, #null_id, #order_by, prepare, #property, #ptr_type, #reset, #resource_name, #should_generate_for, #should_generate_from_manifest, #should_skip_on_client?, sourcefile_to_destfile, #unindent, use, #visibility
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/metarecord/generators/crails/destroy_generator.rb', line 6 def data @data end |
Instance Method Details
#has_many(type, name, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/metarecord/generators/crails/destroy_generator.rb', line 16 def has_many type, name, = {} unless [:dependent].nil? @data[type] ||= [] @data[type] << ({ type: "has_many", class: @model[:classname], field: name, options: }) end end |
#has_one(type, name, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/metarecord/generators/crails/destroy_generator.rb', line 26 def has_one type, name, = {} unless [:dependent].nil? @data[type] ||= [] @data[type] << ({ type: "has_one", class: @model[:classname], field: name, options: }) end end |