Class: IonicNotification::Generators::ModelGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- IonicNotification::Generators::ModelGenerator
- Includes:
- OrmHelpers
- Defined in:
- lib/generators/ionic_notification/model/model_generator.rb
Instance Method Summary collapse
Methods included from OrmHelpers
Instance Method Details
#copy_migration ⇒ Object
14 15 16 |
# File 'lib/generators/ionic_notification/model/model_generator.rb', line 14 def copy_migration migration_template "migration.rb", "db/migrate/add_device_tokens_to_#{table_name}.rb" end |
#inject_ionic_notification_content ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/ionic_notification/model/model_generator.rb', line 18 def inject_ionic_notification_content content = model_contents class_path = if namespaced? class_name.to_s.split("::") else [class_name] end indent_depth = class_path.size - 1 content = content.split("\n").map { |line| " " * indent_depth + line } .join("\n") << "\n" inject_into_class(model_path, class_path.last, content) end |