我最終得到SystemStackError。SystemStackError - 當搜索用戶時,系統堆棧級別太深,用戶搜索
我已經從另一個項目中複製了這個,我做的很好,所以我正在努力解決它爲什麼不工作。
可疑代碼:
class ProfilesController < ApplicationController
before_filter :find_user
def show
if @user
render action: show
else
render file: 'public/404', status: 404, formats: [:html]
end
end
private
def find_user
@user = User.find_by_profile_name(params[:id])
end
end
和錯誤:
Started GET "/Benji" for 127.0.0.1 at 2013-12-07 18:23:57 +0000
ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by ProfilesController#show as HTML
Parameters: {"id"=>"Benji"}
User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."profile_name" = 'Benji' LIMIT 1
Completed 500 Internal Server Error in 111ms
SystemStackError - stack level too deep:
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:70:in `'
感謝
完美的作品!謝謝你的幫助。 – BeamJinn