Class: Adminpanel::Generators::GalleryGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/adminpanel/gallery/gallery_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migrationObject



22
23
24
25
# File 'lib/generators/adminpanel/gallery/gallery_generator.rb', line 22

def create_migration
  migration_template 'gallery_migration.rb', "db/migrate/create_adminpanel_#{lower_name.pluralize}_table.rb"
  puts "don't forget to add the form_field, the relationship and #{lower_name}s_attributes it to attr_accessible"
end

#create_modelObject

argument :reference_model, :aliases => "-m", :type => :string, :require => true, :desc => 'Choose the model that you want the uploader to belong_to'



14
15
16
# File 'lib/generators/adminpanel/gallery/gallery_generator.rb', line 14

def create_model
  template 'gallery_template.rb', "app/models/adminpanel/#{lower_name}.rb"
end

#create_uploaderObject



18
19
20
# File 'lib/generators/adminpanel/gallery/gallery_generator.rb', line 18

def create_uploader
  template 'uploader.rb', "app/uploader/adminpanel/#{lower_name}_uploader.rb"
end