Reputation: 13558
This is the error:
ActiveRecord::AssociationTypeMismatch in VideosController#update Topic(#2173382840) expected, got String(#2148246520)
It's from this method:
def assign_topics
if @topic_names
self.topics = @topic_names.each do |name|
Topic.find_or_create_by_name(name)
end
end
end
What is this error saying? I don't understand there being a type "topic" when topic is a model for me...
Upvotes: 0
Views: 529
Reputation: 1720
"each" returns the original array or enumerable, try using "map" instead
Upvotes: 6