Rapidfire和Devise [英] Rapidfire and Devise

查看:124
本文介绍了Rapidfire和Devise的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我执行了Devise,并通过了安装Rapidfire
和应用程序控制器的说明,我有

  def current_user 
current_user #rb:7
end

def can_administer
true#只是现在...
end

但在页面上我发现错误,如果我在控制台中看到,

  ActionView :: Template ::错误(堆栈级别太深)
app / controllers / application_controller.rb:7

这是 current_user 行。


$ b $你可以创建一个叫做 current_user的方法。

解决方案

,您将返回 current_user 的值。



Ruby不需要您调用方法时使用括号。

  current_user 

是相同的东西,如

  current_user()

您正在一遍又一遍地调用 current_user 函数。



没有理由您定义一个名为 current_user 的方法,当devise给你。


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?

解决方案

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.

这篇关于Rapidfire和Devise的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆