Created
August 17, 2012 14:21
-
-
Save yao2030/3379045 to your computer and use it in GitHub Desktop.
make current_user available in authorizations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
helper_method :current_user | |
private | |
def current_user | |
@current_user ||= User.find(session[:user_id]) if session[:user_id] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M", "provider"=>"twitter"} | |
2012-08-17T14:18:33+00:00 app[web.1]: Completed 500 Internal Server Error in 0ms | |
2012-08-17T14:18:33+00:00 app[web.1]: | |
2012-08-17T14:18:33+00:00 app[web.1]: NoMethodError (undefined method `authorizations' for nil:NilClass): | |
2012-08-17T14:18:33+00:00 app[web.1]: | |
2012-08-17T14:18:33+00:00 app[web.1]: app/controllers/authorizations_controller.rb:9:in `create' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当前用户是nil, 逻辑错啦.