Class: NoBrainer::Generators::AASMGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- NoBrainer::Generators::AASMGenerator
- Includes:
- AASM::Generators::OrmHelpers
- Defined in:
- lib/generators/nobrainer/aasm_generator.rb
Instance Method Summary collapse
- #generate_model ⇒ Object
- #inject_aasm_content ⇒ Object
- #inject_field_types ⇒ Object
- #migration_data ⇒ Object
Methods included from AASM::Generators::OrmHelpers
Instance Method Details
#generate_model ⇒ Object
11 12 13 |
# File 'lib/generators/nobrainer/aasm_generator.rb', line 11 def generate_model invoke 'nobrainer:model', [name] unless model_exists? end |
#inject_aasm_content ⇒ Object
15 16 17 |
# File 'lib/generators/nobrainer/aasm_generator.rb', line 15 def inject_aasm_content inject_into_file model_path, model_contents, after: "include NoBrainer::Document::Timestamps\n" if model_exists? end |
#inject_field_types ⇒ Object
19 20 21 |
# File 'lib/generators/nobrainer/aasm_generator.rb', line 19 def inject_field_types inject_into_file model_path, migration_data, after: "include NoBrainer::Document::Timestamps\n" if model_exists? end |
#migration_data ⇒ Object
23 24 25 |
# File 'lib/generators/nobrainer/aasm_generator.rb', line 23 def migration_data " field :#{column_name}" end |