def render_attribute(resource, attribute, options = {})
      attribute_value = resource.send(attribute[:name])
      if attribute[:relation]
        record = resource.send(attribute[:relation][:name])
        value = record.present? ? record.send(attribute[:relation][:attr_method]) : Alchemy.t(:not_found)
      elsif attribute_value && attribute[:type].to_s =~ /(date|time)/
        localization_format = if attribute[:type] == :datetime
          options[:datetime_format] || :'alchemy.default'
        elsif attribute[:type] == :date
          options[:date_format] || :'alchemy.default'
        else
          options[:time_format] || :'alchemy.time'
        end
        value = l(attribute_value, format: localization_format)
      else
        value = attribute_value
      end

      options.reverse_merge!(truncate: 50)
      if options[:truncate]
        value.to_s.truncate(options.fetch(:truncate, 50))
      else
        value
      end
    end
def render_attribute(resource, attribute, options = {})
      attribute_value = resource.send(attribute[:name])
      if attribute[:relation]
        record = resource.send(attribute[:relation][:name])
        value = record.present? ? record.send(attribute[:relation][:attr_method]) : Alchemy.t(:not_found)
      elsif attribute_value && attribute[:type].to_s =~ /(date|time)/
        localization_format = if attribute[:type] == :datetime
          options[:datetime_format] || :'alchemy.default'
        elsif attribute[:type] == :date
          options[:date_format] || :'alchemy.default'
        else
          options[:time_format] || :'alchemy.time'
        end
        value = l(attribute_value, format: localization_format)
      else
        value = attribute_value
      end

      options.reverse_merge!(truncate: 50)
      if options[:truncate]
        value.to_s.truncate(options.fetch(:truncate, 50))
      else
        value
      end
    end
Returns the value from resource attribute

 If the attribute has a relation, the related object's attribute value will be returned.

 The output will be truncated after 50 chars.
 Pass another number to truncate then and pass false to disable this completely.

 @param [Alchemy::Resource] resource
 @param [Hash] attribute
 @option options [Hash] :truncate (50) The length of the value returned.
 @option options [Hash] :datetime_format (alchemy.default) The format of timestamps.
 @option options [Hash] :time_format (alchemy.time) The format of time values.

 @return [String]