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.0.beta4 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.0.beta3 lib/rails/generators/active_record/session_migration/session_migration_generator.rb
activerecord-3.0.0.beta2 lib/rails/generators/active_record/session_migration/session_migration_generator.rb