Module: InheritedResourcesViews::Helper::InstanceMethods
- Defined in:
- lib/inherited_resources_views/helper.rb
Instance Method Summary collapse
- #display_field(resource, field) ⇒ Object
- #fields ⇒ Object
- #form_field(form, resource, field) ⇒ Object
- #form_fields ⇒ Object
- #hidden_fields ⇒ Object
- #index_fields ⇒ Object
- #show_fields ⇒ Object
Instance Method Details
#display_field(resource, field) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/inherited_resources_views/helper.rb', line 27 def display_field(resource, field) if respond_to?(helper = "#{field}_display") send(helper, resource) else default_display_field(resource, field) end end |
#fields ⇒ Object
7 8 9 |
# File 'lib/inherited_resources_views/helper.rb', line 7 def fields resource_class.column_names - hidden_fields end |
#form_field(form, resource, field) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/inherited_resources_views/helper.rb', line 35 def form_field(form, resource, field) if respond_to?(helper = "#{field}_form_field") send(helper, form, resource) else default_form_field(form, resource, field) end end |
#form_fields ⇒ Object
23 24 25 |
# File 'lib/inherited_resources_views/helper.rb', line 23 def form_fields fields end |
#hidden_fields ⇒ Object
11 12 13 |
# File 'lib/inherited_resources_views/helper.rb', line 11 def hidden_fields %w(id created_at updated_at) end |
#index_fields ⇒ Object
15 16 17 |
# File 'lib/inherited_resources_views/helper.rb', line 15 def index_fields fields end |
#show_fields ⇒ Object
19 20 21 |
# File 'lib/inherited_resources_views/helper.rb', line 19 def show_fields fields end |