に未定義のメソッド `each`を取得する私はこのような方法があります:私のコントローラ
class ProfilesController < ApplicationController
before_filter :authenticate_user!
current_user
def index
@users = User.all
end
...
end
を、私のルートが
match 'profile', :controller => 'profiles', :action => 'index'
ですが、私はhttp://127.0.0.1:8080/profile
にアクセスしたときに私が手:
NoMethodError
inProfiles#index
未定義のメソッドeach
nil:NilClass
エラーの完全なスタックトレースとは何ですか? – Gareth
https://gist.github.com/2464854 - mongoidを使用しています。ちょうどfyi –
これはおそらく実際にはビュー内で発生しています。スタックトレース全体を見て、該当するビューの抜粋を見つけてください。 –