Class: Blacklight::Allmaps::ModelsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Blacklight::Allmaps::ModelsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/blacklight/allmaps/models_generator.rb
Instance Method Summary collapse
-
#copy_migrations ⇒ Object
Setup the database migrations.
- #include_sidecar_allmaps_solrdocument ⇒ Object
Instance Method Details
#copy_migrations ⇒ Object
Setup the database migrations
20 21 22 |
# File 'lib/generators/blacklight/allmaps/models_generator.rb', line 20 def copy_migrations rake "blacklight_allmaps_engine:install:migrations" end |
#include_sidecar_allmaps_solrdocument ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/blacklight/allmaps/models_generator.rb', line 24 def include_sidecar_allmaps_solrdocument sidecar = " \n def sidecar_allmaps\n # Find or create, and set version\n sidecar = Blacklight::Allmaps::Sidecar.where(\nsolr_document_id: id,\n ).first_or_create do |sc|\nsc.solr_version = self._source[\"_version_\"]\n end\n\n sidecar.solr_version = self._source[\"_version_\"]\n sidecar.save\n\n sidecar\n end\n SIDECAR\n\n inject_into_file \"app/models/solr_document.rb\", sidecar, before: /^end/\nend\n" |