Class: BlacklightHighlightGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/blacklight_highlight/blacklight_highlight_generator.rb

Instance Method Summary collapse

Instance Method Details

#inject_catalog_controller_extensionObject



18
19
20
21
22
23
24
25
26
# File 'lib/generators/blacklight_highlight/blacklight_highlight_generator.rb', line 18

def inject_catalog_controller_extension
  file_path = "app/controllers/#{controller_name.underscore}.rb"
  if File.exists? file_path
    inject_into_file file_path, :after => "include Blacklight::Catalog" do
      "\n  include BlacklightHighlight::ControllerExtension\n"
    end
  end

end

#inject_solr_document_extensionObject



8
9
10
11
12
13
14
15
16
# File 'lib/generators/blacklight_highlight/blacklight_highlight_generator.rb', line 8

def inject_solr_document_extension
  file_path = "app/models/#{model_name.underscore}.rb"

  if File.exists? file_path
    inject_into_file file_path, :after => "include Blacklight::Solr::Document" do
      "\n  include BlacklightHighlight::SolrDocumentExtension\n"
    end
  end
end