Class: EavMigrationGenerator
- Inherits:
-
ActiveRecord::Generators::Base
- Object
- ActiveRecord::Generators::Base
- EavMigrationGenerator
- Defined in:
- lib/generators/eav_migration/eav_migration.rb
Instance Method Summary collapse
- #create_eav_migration ⇒ Object
- #migration_file_name ⇒ Object
- #migration_name ⇒ Object
- #model_association_name ⇒ Object
- #model_name ⇒ Object
- #table_name ⇒ Object
Instance Method Details
#create_eav_migration ⇒ Object
12 13 14 15 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 12 def create_eav_migration p name migration_template "eav_migration.erb", "db/migrate/#{migration_file_name}.rb" end |
#migration_file_name ⇒ Object
17 18 19 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 17 def migration_file_name "create_" + table_name end |
#migration_name ⇒ Object
21 22 23 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 21 def migration_name migration_file_name.camelize end |
#model_association_name ⇒ Object
33 34 35 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 33 def model_association_name model_name.underscore.gsub(/\//,'_') end |
#model_name ⇒ Object
29 30 31 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 29 def model_name name end |
#table_name ⇒ Object
25 26 27 |
# File 'lib/generators/eav_migration/eav_migration.rb', line 25 def table_name custom_table_name || "#{name}_#{hash_name}".underscore.gsub(/\//, '_') end |