Module: InheritedResourcesViews::Helper::InstanceMethods

Defined in:
lib/inherited_resources_views/helper.rb

Instance Method Summary collapse

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

#fieldsObject



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_fieldsObject



23
24
25
# File 'lib/inherited_resources_views/helper.rb', line 23

def form_fields
  fields
end

#hidden_fieldsObject



11
12
13
# File 'lib/inherited_resources_views/helper.rb', line 11

def hidden_fields
  %w(id created_at updated_at)
end

#index_fieldsObject



15
16
17
# File 'lib/inherited_resources_views/helper.rb', line 15

def index_fields
  fields
end

#show_fieldsObject



19
20
21
# File 'lib/inherited_resources_views/helper.rb', line 19

def show_fields
  fields
end