Sha256: 28eaeb35ee4e4c7e05f2df53b61b3613cb6d70c41b5226a721b759dbc0b12b06
Contents?: true
Size: 549 Bytes
Versions: 12
Compression:
Stored size: 549 Bytes
Contents
# ----------------------------------------------------------------------------- # => TODO: This looks like a monkeypatch.. make this "the right way".. ActiveRecord::Base.class_eval do def self.type_of name name = name.to_sym associations = self.reflect_on_all_associations.map(&:name) if name.match(/(.*)_id(s)?$/) and associations.include? "#{$1}#{$2}" :association elsif associations.include? name :association elsif self.attribute_names.include? name.to_s :attribute else :none end end end
Version data entries
12 entries across 12 versions & 1 rubygems