has_many :through breaks upon find_or_initialize_by-Collection of common programming errors

I have a model, Feed, that has and belongs to many FilteredUsers. In this case I have implemented it through a has_many :through relationship.

class Feed < ActiveRecord::Base
  has_many :denials, :dependent => :destroy
  has_many :filtered_users, :through => :denials

I would like to create a record if it doesn’t exist or find the object if it does exist. When I try and use the find_or_initialize_by (or find_or_create_by) an exception is thrown saying undefined method 'feed_id=' for params[:user_url]) else feed.filtered_users.find_by_user_url(params[:user_url]).delete end feed.save

warning this is air coded not tested

Originally posted 2013-11-09 23:30:01.