Class: EtHistory::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- EtHistory::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/et_history/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_controller_file ⇒ Object
- #create_initializer ⇒ Object
- #create_migration_file ⇒ Object
- #create_model_file ⇒ Object
- #create_routes_entry ⇒ Object
- #create_view_file ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
38 39 40 |
# File 'lib/generators/et_history/install_generator.rb', line 38 def self.next_migration_number(dirname) ::ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#create_controller_file ⇒ Object
16 17 18 |
# File 'lib/generators/et_history/install_generator.rb', line 16 def create_controller_file template('history_controller.rb', "app/controllers/history_controller.rb") end |
#create_initializer ⇒ Object
29 30 31 |
# File 'lib/generators/et_history/install_generator.rb', line 29 def create_initializer template('paper_trail.rb', "config/initializers/paper_trail.rb") end |
#create_migration_file ⇒ Object
12 13 14 |
# File 'lib/generators/et_history/install_generator.rb', line 12 def create_migration_file migration_template 'create_versions.rb', 'db/migrate/create_versions.rb' end |
#create_model_file ⇒ Object
25 26 27 |
# File 'lib/generators/et_history/install_generator.rb', line 25 def create_model_file template('version.rb', "app/models/version.rb") end |
#create_routes_entry ⇒ Object
34 35 36 |
# File 'lib/generators/et_history/install_generator.rb', line 34 def create_routes_entry route 'resources :history, only: :index' end |
#create_view_file ⇒ Object
20 21 22 23 |
# File 'lib/generators/et_history/install_generator.rb', line 20 def create_view_file directory('history/', 'app/views/history') # template('history_index.html.erb', "app/views/history/index.html.erb") end |