class SimpleAttribute::Attributes::Association

Public Instance Methods

attribute_name() click to toggle source
# File lib/simple_attribute/attributes/association.rb, line 4
def attribute_name
  'association'
end
label_method() click to toggle source
# File lib/simple_attribute/attributes/association.rb, line 8
def label_method
  @options.fetch(:label, :id)
end
render_attribute() click to toggle source
# File lib/simple_attribute/attributes/association.rb, line 20
def render_attribute
  label = value.try(label_method)
  title = value.try(title_method)

  unless url_method.nil?
    value = @context.send(url_method, @value)
  end

  link_to label, value, html_options.merge(title: title)
end
title_method() click to toggle source
# File lib/simple_attribute/attributes/association.rb, line 12
def title_method
  @options.fetch(:title, :id)
end
url_method() click to toggle source
# File lib/simple_attribute/attributes/association.rb, line 16
def url_method
  @options.fetch(:url, nil)
end