I am making a clone app for flea market apps.
On the product detail page, I want to change the display under the following conditions, but it does not work.
・ Only the seller who is logged in will see the "Edit/Delete Product Button".
・ Only users other than the logged-in seller will see the "Go to purchase screen button".
① Whether the user is logged in
② Whether the user who accessed the product details screen is the seller
I'm trying to make a conditional branch.
<% if user_signed_in?%> <% if current_user.id == @ item.user_id%> <% = link_to'Edit product', item_path (@item) method:: get, class: "item-red-btn"%> <p class ='or-text'>or</p> <% = link_to'Delete', "#", method:: delete, class:'item-destroy'%> <% elsif? ?? ?? = Current_user.id? ?? ?? %> <% = link_to'Proceed to purchase screen', "#", class: "item-red-btn"%> <% end%>
What I tried
Regarding (1), we are trying to describe that the currently logged-in user is the user associated with the product.
Regarding (2), I searched various descriptions of elsif conditions that apply to the conditions, but I could not solve it at all.
Could anyone please teach me?
This is my first question, and I may be missing the necessary information and code.
We will present it as soon as you teach us.
Please provide more detailed information here.
Answer # 1
It's okay to use else instead of elsif
- ruby - [rails] i want to change the argument of link_to using conditional branching
- ruby - dynamically display rails select box choices
- ruby on rails - [rails6] i want to display the validation error generated by update by index
- ruby on rails - i want to display the numbers entered in the line graph of chart kick
- ruby on rails - i want to display the latest posting date and time by creating a simple bulletin board
- [ruby on rails] i want to display a parent model that matches the information of the associated child model
- ruby on rails - display all tweets of the user you are following on the top page
- ruby on rails - you cannot change the keychain after downloading the pem file when creating an ec2 instance the matter that come
- ruby on rails - i want to display the details page
- ruby on rails - i want to display the posted image in the background using image_tag or url_for
- ruby on rails - i want to change only a part of the partial template
- ruby on rails - i want to change from the state where only one posted image is displayed to the state where two posted images ar
- ruby on rails - i want to display all the images in the [rails] directory in the browser!
- ruby - i want to display specific columns in rails in descending order of numbers
- ruby on rails 6 - [rails] i want to update the display of chat room participants etc in real time
- ruby - rails comment function display
- ruby on rails 6 - time display on rails
- ruby on rails - i want to display the schedule with rails full calendar
- ruby on rails - [rails] how to round (omission and display) the character string of link_to
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- i want to check the type of a shell script variable