2e177033a18acb3904db0a28fb38048f9e69a44e
[feedcatcher.git] /
1 class SessionMigrationGenerator < Rails::Generator::NamedBase
2 def initialize(runtime_args, runtime_options = {})
3 runtime_args << 'add_session_table' if runtime_args.empty?
4 super
5 end
6
7 def manifest
8 record do |m|
9 m.migration_template 'migration.rb', 'db/migrate',
10 :assigns => { :session_table_name => default_session_table_name }
11 end
12 end
13
14 protected
15 def default_session_table_name
16 ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session'
17 end
18 end