I only want to remove resources if they actually belong to the object. For example:
Post.all.each do |post|
if post.has_method?('name')
true
else
false
end
end
But checking for an association:
Post.all.each do |post|
if post.has_many?('tags')
true
else
false
end
end
or:
Post.all.each do |post|
if post.belongs_to?('category')
true
else
false
end
end
you can write your own methods:
so
Or you can use simple construction:
UPD
Or, as you correctly pointed, you can use
respond_to?