I would like to learn ruby on rails and ı'm traying some project. I want to see an explanation when I hover over the photo with the mouse. I know, how can ı use jquery hover but only rails 5.2 version but ı have rails 6.0.2.2 version .Now how can ı use hover for rails 6.0.2.2 version . You can see error message and my photo on the screenshot. And finally thank you for your help
Error ScreenShot = [[1]: https://i.stack.imgur.com/CjTUF.png]
related code line for jquery Hover Shot.js
shotHover() {
$('.shot').hover(function() {
$(this).children('.shot-data').toggleClass('visible');
});
}
Shots.shotHover();
application.js
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("shots")
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)
index.html.erb
<%= link_to shot, class: "shot" do %>
<%= image_tag(shot.user_shot_url) %>
<div class="shot-data">
<h3 class="shot-title"><%= shot.title %></h3>
<div class="shot-description"><%= truncate(shot.description, length: 60) %></div>
<div class="shot-time">
<%= time_ago_in_words(shot.created_at) %>
</div>
</div>
<% end %>
I have jquery in Gemfile like this. Gemfile
gem 'jquery-rails', '~> 4.3', '>=4.3.1'