Sha256: d99aa1cf4af71e3398711165a08e95f23d12c8e81a5203466437cbe3321e8239

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

class StateSessionGenerator < Rails::Generator::Base
  default_options :skip_migration => false
  
  def manifest    
    record do |m|
      # Controller class, functional test, helper, and views.
      m.template 'controller.rb', 'app/controllers/backend/state_sessions_controller.rb'
      m.template 'functional_test.rb', 'test/functional/backend/state_sessions_controller_test.rb'
      
      unless options[:skip_migration]
        m.migration_template("migration.rb", "db/migrate", :migration_file_name => "create_state_sessions")
      end
      
      m.template('model.rb', 'app/models/state_session.rb')
      # Adding a new route
      m.append("config/routes.rb", "    backend.resources :state_sessions", "map.namespace(:backend) do |backend|")
      m.readme "../REMEMBER"      
    end
  end 


  protected
    def banner
      "Usage: #{$0} state_session_migration [--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

18 entries across 18 versions & 1 rubygems

Version Path
lipsiadmin-4.1.8 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.3.1 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.3.3 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.3.2 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.4.2 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.4.0 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.3 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.3.4 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-3.4.1 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.0 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.1 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.2 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.0.0 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.4 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.5 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.3 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.6 lipsiadmin_generators/state_session/state_session_generator.rb
lipsiadmin-4.1.7 lipsiadmin_generators/state_session/state_session_generator.rb