class Fae::NestedScaffoldGenerator
Public Instance Methods
go()
click to toggle source
# File lib/generators/fae/nested_scaffold_generator.rb, line 7 def go generate_nested_model_file generate_nested_controller_file generate_view_files add_route end
Private Instance Methods
generate_nested_controller_file()
click to toggle source
# File lib/generators/fae/nested_scaffold_generator.rb, line 25 def generate_nested_controller_file @attachments = @@attachments template "controllers/nested_scaffold_controller.rb", "app/controllers/#{options.namespace}/#{file_name.pluralize}_controller.rb" end
generate_nested_model_file()
click to toggle source
# File lib/generators/fae/nested_scaffold_generator.rb, line 16 def generate_nested_model_file generate "model #{file_name} #{@@attributes_flat}" inject_concern inject_display_field_to_model inject_model_attachments inject_position_scope inject_parent_info if options.parent_model.present? end
generate_view_files()
click to toggle source
# File lib/generators/fae/nested_scaffold_generator.rb, line 30 def generate_view_files @form_attrs = set_form_attrs @attachments = @@attachments template "views/table_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/table.html.#{options.template}" template "views/_form_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/_form.html.#{options.template}" template "views/new_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/new.html.#{options.template}" template "views/edit_nested.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/edit.html.#{options.template}" end
inject_parent_info()
click to toggle source
# File lib/generators/fae/nested_scaffold_generator.rb, line 39 def inject_parent_info inject_into_file "app/models/#{file_name}.rb", after: "BaseModelConcern\n" do <<-RUBY \n belongs_to :#{options.parent_model.underscore}, touch: true def fae_nested_parent :#{options.parent_model.underscore} end RUBY end end