2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/helpers/unified_partial_helper.rb', line 2
def attribute_display(object, attribute, options={})
with = options[:with] || :default
attribute_value = object.send(attribute)
layout = options[:layout] || "attribute_presentation/layout"
locals = {
object: object,
attribute: attribute,
value: attribute_value,
label: attribute_label(attribute)
}.merge(options.fetch(:locals, {}))
unless options[:display_blank] || !attribute_value
render partial: "attribute_presentation/#{with}",
locals: locals,
layout: layout
end
end
|