class Hayfork::Generators::HaystackGenerator
Public Instance Methods
copy_migration()
click to toggle source
# File lib/generators/hayfork/haystack_generator.rb, line 18 def copy_migration migration_template "migrations/create.rb", "#{db_migrate_path}/create_#{table_name}.rb", migration_version: migration_version end
copy_model()
click to toggle source
# File lib/generators/hayfork/haystack_generator.rb, line 14 def copy_model template "model.rb", "app/models/#{file_name}.rb" end
copy_query_models()
click to toggle source
# File lib/generators/hayfork/haystack_generator.rb, line 26 def copy_query_models template "query.rb", "app/models/query.rb" template "query/exact_phrase.rb", "app/models/query/exact_phrase.rb" template "query/object.rb", "app/models/query/object.rb" template "query/parser.rb", "app/models/query/parser.rb" end
copy_triggers()
click to toggle source
# File lib/generators/hayfork/haystack_generator.rb, line 22 def copy_triggers template "triggers.rb", "lib/#{file_name}_triggers.rb" end
migration_version()
click to toggle source
# File lib/generators/hayfork/haystack_generator.rb, line 38 def migration_version return unless Rails::VERSION::MAJOR >= 5 "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end
table_name()
click to toggle source
Calls superclass method
# File lib/generators/hayfork/haystack_generator.rb, line 33 def table_name return "haystack" if class_name == "Haystack" super end