2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/textacular/full_text_indexer.rb', line 2
def generate_migration(model_name)
content = <<-MIGRATION
class #{model_name}FullTextSearch < ActiveRecord::Migration
def self.up
execute(<<-SQL.strip)
#{up_migration(model_name)}
SQL
end
def self.down
execute(<<-SQL.strip)
#{down_migration(model_name)}
SQL
end
end
MIGRATION
filename = "#{model_name.underscore}_full_text_search"
generator = Textacular::MigrationGenerator.new(filename, content)
generator.generate_migration
end
|