I was experimenting the polymorphic associaton in Mongoid
class Group
include Mongoid::Document
belongs_to :groupable, polymorphic: true
end
class Album
include Mongoid::Document
has_many :groups, as: groupable
end
then I decided against it. So I removed all those belongs_to and has_many lines above. Yet in the console, whenever I get a Group record that I experimented with, it still has this “groupable_type” attribute. I know remove_attribute nullify the attribute, but does not remove it( sounds a bit like JavaScript). How can I actually remove this attribute from the database from Mongoid?
You could do this: