- name_without_id_or_type = name.sub(/_(id|type)$/, '') - if resource.class.reflect_on_association(name_without_id_or_type).try(:options).try('[]', :polymorphic) == true -# name =~ /_id$/ is required to prevent user template from being renedred 2x times: -# first time for _id field, second time for _type field - if name =~ /_id$/ && has_template?( "_#{view_prefix}.#{name_without_id_or_type}" ) = render "#{view_prefix}.#{name_without_id_or_type}", :resource => resource, :name => name, :view_prefix => view_prefix - elsif has_template? "_#{view_prefix}.#{name}" = render "#{view_prefix}.#{name}", :resource => resource, :name => name, :view_prefix => view_prefix - elsif resource.send(name).blank? == false - render_field_type, use_i18n = render_field_type(resource, name) - if use_i18n and has_template?( "_show.field_type_#{render_field_type}_i18n" ) = render "show.field_type_#{render_field_type}_i18n", :resource => resource, :name => name - elsif has_template?( "_show.field_type_#{render_field_type}" ) = render "show.field_type_#{render_field_type}", :resource => resource, :name => name - else = render "show.field_type_text", :resource => resource, :name => name