Class: PgSearch::Migration::Generator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PgSearch::Migration::Generator
show all
- Defined in:
- lib/pg_search/migration/generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.inherited(subclass) ⇒ Object
11
12
13
14
|
# File 'lib/pg_search/migration/generator.rb', line 11
def self.inherited(subclass)
super
subclass.source_root File.expand_path('templates', __dir__)
end
|
Instance Method Details
#create_migration ⇒ Object
16
17
18
19
20
|
# File 'lib/pg_search/migration/generator.rb', line 16
def create_migration
now = Time.now.utc
filename = "#{now.strftime('%Y%m%d%H%M%S')}_#{migration_name}.rb"
template "#{migration_name}.rb.erb", "db/migrate/#{filename}", migration_version
end
|