ruby on rails - ActiveRecord: Is there a method to get the type of association between two classes? -
something like:
post.association(comment) => :has_many
yes. use *reflect_on_association*
post.reflect_on_association(:comments).macro
something like:
post.association(comment) => :has_many
yes. use *reflect_on_association*
post.reflect_on_association(:comments).macro
Comments
Post a Comment