Undefined method pluck for array?
pluck
is used with rails to change the association query against the database. It will change it from SELECT *
to SELECT [attr]
where [attr]
is the argument to pluck. Since it's an array, you can't use it. You should instead use regular old map
from ruby. In your case, it would look something like:
def pwd
self.ancestors.map(&:name)
end