lib/generators/dry_crud/templates/app/helpers/standard_helper.rb
def association(obj, attr, *macros)
    if obj.class.respond_to?(:reflect_on_association)
      name = assoc_and_id_attr(attr).first.to_sym
      assoc = obj.class.reflect_on_association(name)
      assoc if assoc && (macros.blank? || macros.include?(assoc.macro))
    end
  end
# Returns the association proxy for the given attribute. The attr parameter
# may be the _id column or the association name. If a macro (e.g. :belongs_to)
# is given, the association must be of this type, otherwise, any association
# is returned. Returns nil if no association (or not of the given macro) was
# found.
Returns the association proxy for the given attribute. The attr parameter
may be the _id column or the association name. If a macro
is given, the association must be of this type, otherwise, any association
is returned. Returns nil if no association (or not of the given macro) was
found.
Returns the association proxy for the given attribute . The attr parameter may be the _id column or the association name . If a macro is given the association must be of this type otherwise any association is returned . Returns nil if no association ( or not of the given macro ) was found .
def association(obj, attr, *macros)
    if obj.class.respond_to?(:reflect_on_association)
      name = assoc_and_id_attr(attr).first.to_sym
      assoc = obj.class.reflect_on_association(name)
      assoc if assoc && (macros.blank? || macros.include?(assoc.macro))
    end
  end
def association ( obj , attr , * macros ) if obj . class . respond_to? ( :reflect_on_association ) name = assoc_and_id_attr ( attr ) . first . to_sym assoc = obj . class . reflect_on_association ( name ) assoc if assoc && ( macros . blank? || macros . include? ( assoc . macro ) ) end end
Returns the association proxy for the given attribute.
Returns the association proxy for the given attribute .
obj
attr
macros