Method: EffectiveResourcesHelper#render_resource_form

Defined in:
app/helpers/effective_resources_helper.rb

#render_resource_form(resource, atts = {}) ⇒ Object

When called from /admin/things/new.html.haml this will render ‘admin/things/form’, or ‘things/form’, or ‘thing/form’



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/helpers/effective_resources_helper.rb', line 42

def render_resource_form(resource, atts = {})
  atts = {:namespace => (resource.namespace.to_sym if resource.namespace.present?), resource.name.to_sym => instance_variable_get('@' + resource.name)}.compact.merge(atts)

  if lookup_context.template_exists?('form', controller._prefixes, :partial)
    render 'form', atts
  elsif lookup_context.template_exists?('form', resource.plural_name, :partial)
    render "#{resource.plural_name}/form", atts
  elsif lookup_context.template_exists?('form', resource.name, :partial)
    render "#{resource.name}/form", atts
  else
    render 'form', atts  # Will raise the regular error
  end
end