I am not sure if my question is formulated correctly.
I have three models: User, Itemand UserItem.
user has_many :user_items
user has_many :items, through :user_items
item has_many :user_items
item has_many :users -> {uniq}, through :user_items
item belongs_to :user
user_item belongs_to :user
user_item belongs_to :item
I need to find out if the user has an element for creating statements ifin the views of my positions. But here catch, user_items have enum status: [ :pending, approved]. So I need to see if there is an current_userelement :pending.
For example, when a user visits the page view1 item1, I have the action show_controller show declare @item = Item.find_by_id(params[:id]). But what can I do with this @itemto find out if the user has this element?