Read more

Check whether a getter is an attribute or an association

Dominik Schöler
March 08, 2011Software engineer at makandra GmbH

Sometimes you might want to know if an attribute is an associated object or a simple string, integer etc. You can use the reflect_on_association Show archive.org snapshot method for that.

if Person.reflect_on_association(:address)
  Person.address.attributes # do something
else
  Person.address # do something else
end
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot
Posted by Dominik Schöler to makandra dev (2011-03-08 17:11)