覆盖控制器操作后,活动管理布局丢失
我的新控制器操作:
controller do
layout 'active_admin'
def index
@pages = Page.all
end
end
刷新页面后我收到:
undefined method `base' for nil:NilClass
render view_factory.layout
我应该做什么来解决这个问题?
我开始重写控制器操作,因为我收到了有关索引操作的消息:
undefined method `num_pages' for #<Array:0x0000000b860eb0>
render renderer_for(:index)
也许有人知道如何解决此问题?
My new controller action:
controller do
layout 'active_admin'
def index
@pages = Page.all
end
end
After refresh the page i received:
undefined method `base' for nil:NilClass
render view_factory.layout
What should I do for fixing this?
I start rewriting controller action because i received this message for my index action:
undefined method `num_pages' for #<Array:0x0000000b860eb0>
render renderer_for(:index)
Maybe anyone know how fixing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您在的初始
ApplicationController
的before_filter
中设置了实例变量,则可能会出现 #未定义方法“num_pages” > 像我一样使用模型的复数名称。该错误已在此处报告。
The initial
undefined method 'num_pages' for #<Array:0x0000000b860eb0>
may be occurring if you have an instance variable set in abefore_filter
inApplicationController
with the plural name of a model as I did. The bug is reported here.需要在视图页面上查看代码,但在我看来,您正在对
array
类的对象调用num_pages
。由于 Ruby 的数组类没有 num_pages 方法,因此它会抛出错误。Would need to see the code on the view page for this but it sounds to me like you are making a call for
num_pages
on an object that is anarray
class. Since Ruby's array class has nonum_pages
method, it is throwing an error.杰米你是对的!但后来我收到了这条关于我的索引操作的消息:
我通过这样做解决了这个问题:
报告了错误 这里。
Jamie you are right! But then i received this message for my index action:
And I fix this problem by doing this:
The bug is reported here.