Class: Blacklight::ModelsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Blacklight::ModelsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/blacklight/models_generator.rb
Instance Method Summary collapse
- #add_routes ⇒ Object
-
#copy_migrations ⇒ Object
Setup the database migrations.
-
#create_configuration_files ⇒ Object
Copy all files in templates/config directory to host config.
Instance Method Details
#add_routes ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/blacklight/models_generator.rb', line 30 def add_routes route <<-EOF concern :exportable, Blacklight::Routes::Exportable.new resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do concerns :exportable end resources :bookmarks, only: [:index, :update, :create, :destroy] do concerns :exportable collection do delete 'clear' end end EOF end |
#copy_migrations ⇒ Object
Setup the database migrations
26 27 28 |
# File 'lib/generators/blacklight/models_generator.rb', line 26 def copy_migrations rake "blacklight:install:migrations" end |
#create_configuration_files ⇒ Object
Copy all files in templates/config directory to host config
20 21 22 23 |
# File 'lib/generators/blacklight/models_generator.rb', line 20 def create_configuration_files copy_file "config/blacklight.yml", "config/blacklight.yml" gsub_file 'config/blacklight.yml', '__VERSION__', Blacklight::VERSION end |