Class: Ruflet::Generators::FormGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ruflet::Generators::FormGenerator
- Defined in:
- lib/generators/ruflet/form/form_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_application_component ⇒ Object
15 16 17 18 19 20 |
# File 'lib/generators/ruflet/form/form_generator.rb', line 15 def create_application_component target = File.join(destination_root, Ruflet::Rails::InstallSupport.application_component_path) return if File.exist?(target) create_file target, Ruflet::Rails::InstallSupport.application_component_template end |
#create_ruflet_form ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/ruflet/form/form_generator.rb', line 22 def create_ruflet_form target = File.join(destination_root, form_view_path) create_file( target, Ruflet::Rails::InstallSupport.form_view_template( model_name: model_name, attributes: form_attributes ) ) end |
#print_form_status ⇒ Object
34 35 36 37 38 |
# File 'lib/generators/ruflet/form/form_generator.rb', line 34 def print_form_status names = Ruflet::Rails::InstallSupport.model_names(model_name) say "Ruflet form generated at #{form_view_path}" say "Call #{names[:class_name]}Form.render(page, record: #{names[:class_name]}.new) from any Ruflet view." end |