Impressionist generator now accepts --orm option (defaults to active_record).
This commit is contained in:
parent
0e7d75d1ec
commit
ecb95519ec
|
@ -0,0 +1,21 @@
|
|||
module ActiveRecord
|
||||
module Generators
|
||||
class ImpressionistGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
source_root File.join(File.dirname(__FILE__), 'templates')
|
||||
|
||||
def self.next_migration_number(dirname)
|
||||
sleep 1
|
||||
if ActiveRecord::Base.timestamped_migrations
|
||||
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
||||
else
|
||||
"%.3d" % (current_migration_number(dirname) + 1)
|
||||
end
|
||||
end
|
||||
|
||||
def create_migration_file
|
||||
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
require 'rails/generators'
|
||||
require 'rails/generators/migration'
|
||||
|
||||
class ImpressionistGenerator < Rails::Generators::Base
|
||||
include Rails::Generators::Migration
|
||||
source_root File.join(File.dirname(__FILE__), 'templates')
|
||||
|
||||
def self.next_migration_number(dirname)
|
||||
sleep 1
|
||||
if ActiveRecord::Base.timestamped_migrations
|
||||
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
||||
else
|
||||
"%.3d" % (current_migration_number(dirname) + 1)
|
||||
end
|
||||
end
|
||||
|
||||
def create_migration_file
|
||||
migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb'
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
module Impressionist
|
||||
module Generators
|
||||
class ImpressionistGenerator < Rails::Generators::Base
|
||||
hook_for :orm
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue