Sha256: dc82cc4b81695320065915444c1effb92608574147f1827751a4cf27ab93999a

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

require '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

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-3.0.0.beta lib/generators/active_record/session_migration/session_migration_generator.rb