问题
I implemented Devise and went through the instructions to install Rapidfire and for the application controller I have
def current_user
current_user #rb:7
end
def can_administer
true # just for right now...
end
but on the page I get a something went wrong and if I look in the console it says
ActionView::Template::Error (stack level too deep)
app/controllers/application_controller.rb:7
which is the current_user
line.
Can anyone tell me whats going on?
回答1:
You are creating a method called current_user
, and you are returning the value of current_user
.
Ruby doesn't require that you use parenthesis when calling methods.
current_user
is the same thing as
current_user()
You are calling the current_user
function over and over and over again.
There is no reason for you to define a method called current_user
, when devise gives that to you.
来源:https://stackoverflow.com/questions/22019767/rapidfire-and-devise