I\'m working on an app that downloads meta tags from websites and saves then. The downloading happens in a model called Site
. I\'d like to save off the downloaded
The problem is here:
self.robots_tags.robots_meta = tag
self.robots_tags
is a collection of objects defined by has_many :robots_tags
, and you're attempting to assign a specific attribute to that entire collection. You can't do this. If you want to assign to an attribute on a specific object, you have to either iterate over the collection, or select a specific object from the collection via first
or last
or any of the other Enumerable
methods.
By inspection, the offending line appears to be:
self.robots_tags.robots_meta = tag
You should iterate over self.robots_tags
instead, with something like:
self.robots_tags.each do |robot_tag|
robot_tag.robots_meta = tag
end