search for: find_or_create_by_tag

Displaying 1 result from an estimated 1 matches for "find_or_create_by_tag".

2009 Jan 01
1
HasManyThroughCantAssociateNewRecords Exception
...ny :types, :through => :video_types, :uniq => :true def get_tag_list(delimiter) tags.collect { |t| t.tag }.join(delimiter) end def set_tag_list(tag_list, delimiter) # doesn''t remove old tags tag_list.split('','').each do |t| tags << Tag.find_or_create_by_tag(t) end end end When I call @video.set_tag_list(params[:tag_list], '','') in my controller, it throws the exception - Cannot associate new records through ''Video#video_tags'' on ''#''. Both records must have an id in order to create the has_man...