Class: BrainDamage::View::Display::ForeignSinglePageManager
- Inherits:
-
Base
- Object
- Templateable::Base
- Templateable::FieldTemplateable
- Base
- BrainDamage::View::Display::ForeignSinglePageManager
- Defined in:
- lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb
Instance Attribute Summary collapse
-
#foreign_model_class_name ⇒ Object
readonly
Returns the value of attribute foreign_model_class_name.
-
#foreign_plural_table_name ⇒ Object
readonly
Returns the value of attribute foreign_plural_table_name.
-
#foreign_singular_table_name ⇒ Object
readonly
Returns the value of attribute foreign_singular_table_name.
Attributes inherited from Templateable::FieldTemplateable
Attributes inherited from Templateable::Base
#inner_html, #options, #template_file
Instance Method Summary collapse
-
#initialize(field, options) ⇒ ForeignSinglePageManager
constructor
A new instance of ForeignSinglePageManager.
- #options_hash ⇒ Object
- #resource_name_according_to_foreign ⇒ Object
Methods inherited from Base
Methods inherited from Templateable::FieldTemplateable
#empty_haml_path, #label_guard?, #method_missing, #render, #show?, #show_label?
Methods inherited from Templateable::Base
#indent, #method_missing, #render, #render_erb_file, #render_erb_string, #render_template_file
Constructor Details
#initialize(field, options) ⇒ ForeignSinglePageManager
Returns a new instance of ForeignSinglePageManager.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 12 def initialize(field, ) super = { deletable: true, editable: true, viewable: false, explicit_form: false, leading_form: false, trailing_form: true, nested_on: resource_name_according_to_foreign.to_sym } @spm_options = .merge().slice(*.keys) @foreign_model_class_name = @field.relation.class_name.to_s @foreign_singular_table_name = @foreign_model_class_name.underscore.singularize @foreign_plural_table_name = @foreign_model_class_name.underscore.pluralize end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BrainDamage::Templateable::FieldTemplateable
Instance Attribute Details
#foreign_model_class_name ⇒ Object (readonly)
Returns the value of attribute foreign_model_class_name.
8 9 10 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 8 def foreign_model_class_name @foreign_model_class_name end |
#foreign_plural_table_name ⇒ Object (readonly)
Returns the value of attribute foreign_plural_table_name.
10 11 12 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 10 def foreign_plural_table_name @foreign_plural_table_name end |
#foreign_singular_table_name ⇒ Object (readonly)
Returns the value of attribute foreign_singular_table_name.
9 10 11 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 9 def foreign_singular_table_name @foreign_singular_table_name end |
Instance Method Details
#options_hash ⇒ Object
40 41 42 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 40 def @spm_options.dup end |
#resource_name_according_to_foreign ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/generators/brain_damage/lib/views/displays/foreign_single_page_manager.rb', line 32 def resource_name_according_to_foreign if @field.relation @field.relation.resource_name_according_to_foreign else singular_table_name end end |