app/assets/imagesI want to display all the .JPG images in the browser.
I wrote the following code, but an error has occurred in the image_tag part of View.
def index @pictures = Dir.glob ("app/assets/images/*. JPG") end
<% @ pictures.each do | pic |%> <% = image_tag pic%> <% end%>
I would like to know what is wrong.
I look forward to working with you.
Answer # 1
app/assets/imagesWhat is in
image_tag file nameIt's fine.
@pictures = Dir.glob ("* .JPG", base: "app/assets/images")
- ruby on rails - i want to display the posted images in a random order (get information from the record)
- ruby on rails - display all tweets of the user you are following on the top page
- ruby on rails 6 - i want to change the display of the product detail page according to the user's conditions
- ruby - how to save in db and display data in view (including images)
- ruby on rails - i implemented it so that images can be saved in s3 of aws, but the view can no longer be displayed
- ruby on rails - rename rails directory (folder name)
- ruby on rails - i want to display the details page
- ruby on rails 6 - [rails] i want to update the display of chat room participants etc in real time
- 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 - dynamically display rails select box choices
- bootstrap display in ruby on rails is broken
- ruby on rails - i want to display the latest posting date and time by creating a simple bulletin board
- ruby - how to upload images directly from rails to s3 on aws
- 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 display a parent model that matches the information of the associated child model
- ruby on rails - [rails] how to round (omission and display) the character string of link_to
- ruby on rails - i want to display the schedule with rails full calendar
- ruby on rails 6 - time display on rails
- 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
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
- xcode - pod install [!] no `podfile 'found in the project directory