refactor generator
parent
656f2785fa
commit
dd1c8e2dd2
|
@ -4,12 +4,16 @@ module Rating
|
||||||
class InstallGenerator < Rails::Generators::Base
|
class InstallGenerator < Rails::Generators::Base
|
||||||
source_root File.expand_path('../templates', __FILE__)
|
source_root File.expand_path('../templates', __FILE__)
|
||||||
|
|
||||||
desc 'configure Rating'
|
desc 'creates Rating migration'
|
||||||
|
|
||||||
def create_migration
|
def create_migration
|
||||||
version = Time.current.strftime('%Y%m%d%H%M%S')
|
template 'db/migrate/create_rating_tables.rb', "db/migrate/#{timestamp}_create_rating_tables.rb"
|
||||||
|
end
|
||||||
|
|
||||||
template 'db/migrate/create_rating_tables.rb', "db/migrate/#{version}_create_rating_tables.rb"
|
private
|
||||||
|
|
||||||
|
def timestamp
|
||||||
|
Time.current.strftime '%Y%m%d%H%M%S'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue