Class: Sunrise::Feedbacks::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sunrise::Feedbacks::InstallGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/sunrise/feedbacks/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.current_time ⇒ Object
14 15 16 17 |
# File 'lib/generators/sunrise/feedbacks/install_generator.rb', line 14 def self.current_time @current_time ||= Time.now @current_time += 1.minute end |
.next_migration_number(dirname) ⇒ Object
19 20 21 |
# File 'lib/generators/sunrise/feedbacks/install_generator.rb', line 19 def self.next_migration_number(dirname) current_time.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#create_migration ⇒ Object
28 29 30 31 32 33 |
# File 'lib/generators/sunrise/feedbacks/install_generator.rb', line 28 def create_migration if .migrations migration_template "create_feedback_messages.rb", File.join('db/migrate', "sunrise_create_feedback_messages.rb") migration_template "create_feedback_answers.rb", File.join('db/migrate', "sunrise_create_feedback_answers.rb") end end |
#create_model ⇒ Object
23 24 25 26 |
# File 'lib/generators/sunrise/feedbacks/install_generator.rb', line 23 def create_model copy_file('feedback_message.rb', 'app/models/feedback_message.rb') copy_file('feedback_answer.rb', 'app/models/feedback_answer.rb') end |