class KnowMore::InstallGenerator
Public Instance Methods
before_all()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 13 def before_all @model_name = model_name.underscore end
copy_concerns()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 24 def copy_concerns template 'concerns.rb.erb', 'app/controllers/concerns/know_more/questionnaire_controller_concerns.rb' end
copy_views()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 17 def copy_views KnowMore.config.pages.times do |n| @n = n+1 copy_template end end
generate_migration()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 32 def generate_migration template 'models/migration.rb.erb', "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_#{model_name}.rb" end
generate_model()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 28 def generate_model template 'models/model.rb.erb', "app/models/#{@model_name}.rb" end
Private Instance Methods
copy_template()
click to toggle source
# File lib/generators/know_more/install_generator.rb, line 37 def copy_template template_engine = 'erb' if options.haml? template_engine = 'haml' end template "#{template_engine}/page_template.erb", "app/views/know_more/questionnaire/step#{@n}.html.#{template_engine}" end