私はこれを約2日間理解しようとしてきましたが、何が問題なのかについてのアイデアが不足しています. アプリを Heroku にプッシュしましたが、問題はありませんが、ログにサインインしようとすると、これが出力されます。 Heroku ログ
NameError (初期化されていない定数 User::Story):
[ActiveJob] ElasticsearchIndexJob (ジョブ ID: ######) を引数 "index"、"User"、1 で sidekiq(elasticsearch) にエンキューしました
次に、メソッドの場所を示します
app/models/concerns/searchable_user.rb:43:in 'index_document'
def index_document
ElasticsearchIndexJob.perform_later('index', 'User', self.id)
self.stories.find_each do |storie|
ElasticsearchIndexJob.perform_later('index', 'Storie', storie.id) if storie.published?
end
end
私がStorieを使用したプロジェクトの開始時から、Storyがどこから来ていると考えているのか、私にはわかりません。
ユーザー.rb
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable, :omniauth_providers => [:facebook, :twitter, :google_oauth2]
validates :username, presence: true
validate :avatar_image_size
has_many :stories, dependent: :destroy
ストーリー.rb
class Storie < ApplicationRecord
validates :title, :body, :user_id, presence: true
belongs_to :user
これ以上情報が必要な場合はお知らせください。ハッキングを続けます。うまくいけば修正します。