Sha256: 4f5635f27faf8e5e4442edce468f531d9aea71fda074e323855be04e8b79b331

Contents?: true

Size: 690 Bytes

Versions: 43

Compression:

Stored size: 690 Bytes

Contents

require 'rails/generators/active_record'

module ActiveRecord
  module Generators
    class SessionMigrationGenerator < Base
      argument :name, :type => :string, :default => "add_sessions_table"

      def create_migration_file
        migration_template "migration.rb", "db/migrate/#{file_name}.rb"
      end

      protected

        def session_table_name
          current_table_name = ActiveRecord::SessionStore::Session.table_name
          if ["sessions", "session"].include?(current_table_name)
            current_table_name = (ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session')
          end
          current_table_name
        end

    end
  end
end

Version data entries

43 entries across 43 versions & 2 rubygems

Version Path
activerecord-3.0.20 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.19 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.18 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.17 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.16 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.15 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.14 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.13 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.13.rc1 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.12 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.12.rc1 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.11 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.10 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.10.rc1 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.9 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.9.rc5 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.9.rc4 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.9.rc3 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.9.rc1 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.8 lib/rails/generators/active_record/session_migration/session_migration_generator.rb