質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

916閲覧

Rails6 jscroll 無限スクロール 本番環境読み込まれない

mbaby__8

総合スコア66

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

1グッド

0クリップ

投稿2020/11/17 03:13

編集2020/11/18 05:27

jscrollを用いて無限スクロールを実装しているのですが、

開発環境では動くのが本番環境にいくと動いてくれません。

class="jscroll-added"はどちらも表示されているのですが、本番環境だと読み込みたい中身(f-item)がうまく表示できない状態です。

loadingHtml: '読み込み中'で指定した'読み込み中'も表示されています。

原因としてはどういったことが考えられるのでしょうか?

class="jscroll-added"は追加されているので、postgresqlの問題なのか

jsの書き方が悪いのかわかりません。

教えて頂けると幸いです。


(開発環境)
開発環境
(本番)
イメージ説明

$(document).on('turbolinks:load', function() { var jscrollOption = { callback: true, loadingHtml: '読み込み中', // 記事読み込み中の表示、画像等をHTML要素で指定することも可能 autoTrigger: true, // 次の表示コンテンツの読み込みを自動( true )か、ボタンクリック( false )にする padding: 20,// autoTriggerがtrueの場合、指定したコンテンツの下から何pxで読み込むか指定 nextSelector: 'a.next', // 次に読み込むコンテンツのURLのあるa要素を指定 contentSelector:'.f-item' } $('.f-container').jscroll(jscrollOption); $(document).on('click','.f-item',function(){ $(this).children(".post-content").slideToggle(200); $(this).children(".arrow").toggleClass("toggle"); }); });
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.5.8' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.3', '>= 6.0.3.2' # Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0' # Use Puma as the app server gem 'puma', '~> 4.1' # Use SCSS for stylesheets gem 'sass-rails', '>= 6' # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker gem 'webpacker', '~> 4.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Active Storage variant gem 'image_processing', '~> 1.2' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false gem 'kaminari' gem 'kaminari-i18n' # gem 'jquery-rails' gem 'rails-i18n', '~> 6.0.0' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '~> 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'devise' gem 'cancancan' gem 'serviceworker-rails' gem 'chartkick' gem 'groupdate' gem "aws-sdk-s3", require: false gem 'heroku-deflater', :group => :production
beskey3👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問