Class: Blacklight::ModelsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/blacklight/models_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routesObject



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 do
concerns :exportable

collection do
  delete 'clear'
end
  end
  EOF
end

#copy_migrationsObject

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_filesObject

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