Class: Unread::PolymorphicReaderMigrationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Unread::PolymorphicReaderMigrationGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/unread/polymorphic_reader_migration/polymorphic_reader_migration_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/generators/unread/polymorphic_reader_migration/polymorphic_reader_migration_generator.rb', line 15 def self.next_migration_number(dirname) if self. Time.now.utc.strftime('%Y%m%d%H%M%S') else "%.3d" % (current_migration_number(dirname) + 1) end end |
.timestamped_migrations? ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/unread/polymorphic_reader_migration/polymorphic_reader_migration_generator.rb', line 23 def self. ( ActiveRecord::Base.respond_to?(:timestamped_migrations) && ActiveRecord::Base. ) || ( ActiveRecord.respond_to?(:timestamped_migrations) && ActiveRecord. ) end |
Instance Method Details
#create_migration_file ⇒ Object
11 12 13 |
# File 'lib/generators/unread/polymorphic_reader_migration/polymorphic_reader_migration_generator.rb', line 11 def create_migration_file migration_template 'unread_polymorphic_reader_migration.rb', 'db/migrate/unread_polymorphic_reader_migration.rb' end |