Sha256: 29c18883ac0795e52a15961055fc02c5cc70347219e319eb028779e4cd3119ef

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

class AttachmentGenerator < Rails::Generator::Base
  default_options :skip_migration => false
  
  def manifest    
    record do |m|
      unless options[:skip_migration]
        m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_attachments")
      end
      m.append("config/routes.rb", "    backend.resources :attachments, :collection => { :order => :post }", "map.namespace(:backend) do |backend|")
      m.directory('app/controllers/backend')
      m.directory('app/models')
      m.template('model.rb', 'app/models/attachment.rb')
      m.template('controller.rb', 'app/controllers/backend/attachments_controller.rb')
      m.readme "../REMEMBER"      
    end
  end 


  protected
    def banner
      "Usage: #{$0} attachment [--skip-migration]"
    end
    
    def add_options!(opt)
      opt.separator ''
      opt.separator 'Options:'
      opt.on("--skip-migration",
             "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
    end
 
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
lipsiadmin-5.1.6 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.5 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.4 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.3 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.2 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.1 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.1.0 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.9 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.8 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.7 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.6 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.5 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.4 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-4.1.8 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.0 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.1 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.2 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-5.0.3 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-4.1.5 lipsiadmin_generators/attachment/attachment_generator.rb
lipsiadmin-4.1.4 lipsiadmin_generators/attachment/attachment_generator.rb