has_many :items, dependent: :destroy, inverse_of: :user
belongs_to :user, optional: true, counter_cache: true, inverse_of: :items
belongs_to :user has_many :items, dependent: :destroy, inverse_of: :client
belongs_to :user has_many :items, dependent: :destroy, inverse_of: :business
has_one :client, dependent: :destroy has_one :business, dependent: :destroy
belongs_to :client, optional: true, counter_cache: true, inverse_of: :items belongs_to :business, optional: true, counter_cache: true, inverse_of: :items
def new current_user.business.items.new end
def new if current_user.client @item = current_user.client.items.new elsif current_user.business @item = current_user.business.items.new else current_user.items.new end end