<%= turbo_frame_tag "products_display" do %> <%= content_tag :div, id: dom_id(product) do %> <%= link_to product_path(product), data: {turbo_frame:"_top"} do %> ....... <% end %> <% end %> <% end %>
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