lib/generators/unread/migration/migration_generator.rb in unread-0.13.0 vs lib/generators/unread/migration/migration_generator.rb in unread-0.13.1

- old
+ new

@@ -11,13 +11,24 @@ def create_migration_file migration_template 'migration.rb', 'db/migrate/unread_migration.rb' end def self.next_migration_number(dirname) - if ActiveRecord::Base.timestamped_migrations + if self.timestamped_migrations? Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end + end + + def self.timestamped_migrations? + ( + ActiveRecord::Base.respond_to?(:timestamped_migrations) && + ActiveRecord::Base.timestamped_migrations + ) || + ( + ActiveRecord.respond_to?(:timestamped_migrations) && + ActiveRecord.timestamped_migrations + ) end end end