1
エラー: (nilのための強調テキスト未定義のメソッド `プロファイル」:NilClass)ページ番号ホームにNoMethodErrorルビー/ Railsの - ページの#ホームでNoMethodError - パーシャルビュー
コントローラー:pages_controller.rb
class PagesController < ApplicationController
before_action :authenticate_user!, except: [:landing, :home, :plan]
def home
@contributor_plan = Plan.find(1)
@elitecontributor_plan = Plan.find(2)
@technician_plan = Plan.find(3)
@elitetechnician_plan = Plan.find(4)
@center_plan = Plan.find(5)
@elitecenter_plan = Plan.find(6)
@affair_plan = Plan.find(7)
@eliteaffair_plan = Plan.find(8)
end
私はbefore_filterを改訂しました。ありがとうございました。ただし、エラーメッセージが残ります。私はpages_controllerで "user"を適切に定義していないと仮定します。これは正しいでしょうか? –
@NathanielRand私の答えを更新しました。見て、それが問題を解決するかどうかを教えてください。 –
問題は解決されました。あなたの貢献は評価されます。したがって、Deviseの「current_user」はどの「authenticate_user!」にも適用できます。ページ? –