Class: Adminterface::Generators::CommentsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/adminterface/comments/comments_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



9
10
11
12
# File 'lib/generators/adminterface/comments/comments_generator.rb', line 9

def self.next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#create_initializerObject



18
19
20
21
# File 'lib/generators/adminterface/comments/comments_generator.rb', line 18

def create_initializer
  template "active_admin_comment_action_text.rb",
    "config/initializers/active_admin_comment_action_text.rb"
end

#create_migrationsObject



23
24
25
26
# File 'lib/generators/adminterface/comments/comments_generator.rb', line 23

def create_migrations
  migration_template "migrations/drop_body_for_active_admin_comments.rb.erb",
    "db/migrate/drop_body_for_active_admin_comments.rb"
end

#install_action_textObject



14
15
16
# File 'lib/generators/adminterface/comments/comments_generator.rb', line 14

def install_action_text
  rails_command "action_text:install"
end

#show_readmeObject



28
29
30
# File 'lib/generators/adminterface/comments/comments_generator.rb', line 28

def show_readme
  readme "README" if behavior == :invoke
end