class Adminpanel::MigrationGenerator
Public Instance Methods
change_field_aliases()
click to toggle source
# File lib/generators/adminpanel/migration/migration_generator.rb, line 14 def change_field_aliases fields.each do |attribute| type = attribute.split(':').second case type when 'wysiwyg' fields.delete(attribute) fields << attribute.split(':').first + ':' + 'text' end end end
generate_migration()
click to toggle source
# File lib/generators/adminpanel/migration/migration_generator.rb, line 25 def generate_migration parameters = fields parameters.delete_if do |pair| if pair.split(':').second == 'has_many' puts "migrations aren't supported yet, sorry :(, but you can do a pull request" true else false end end invoke :migration, [migration_name, parameters] end
inject_attributes_into_file()
click to toggle source
# File lib/generators/adminpanel/migration/migration_generator.rb, line 38 def inject_attributes_into_file inject_into_file( "app/models/adminpanel/#{resource_migrating}.rb", after: ' [' ) do indent ("\n" + form_attributes_hash + ','), 8 end end
puts_messages()
click to toggle source
# File lib/generators/adminpanel/migration/migration_generator.rb, line 47 def puts_messages puts "don't forget to migrate your database" end