gpt4 book ai didi

ruby-on-rails - Admin::FaqsController:Class 的未定义方法 `t'

转载 作者:行者123 更新时间:2023-12-03 14:31:19 25 4
gpt4 key购买 nike

在我的项目中,我在命名空间管理员中有 Controller ,并且我正在使用 breadcrumbs_on_rails 来构建面包屑。我的 Controller 看起来像:
模块管理员

class FaqsController < Admin::ApplicationController
include FaqsHelper
load_and_authorize_resource

add_breadcrumb t('faqs.faqs_list') , :faqs_path #this line makes the problem
def index
@faqs = @faqs
add_breadcrumb t('faqs.faqs_list')

end

def new
add_breadcrumb t('faqs.new')
end

#other code ommitted
end
end

我可以在新建、编辑和其他 Controller Action 中使用 t 方法,但是当这个“t”不在 Controller Action 中时,我有以下错误:
undefined method `t' for Admin::FaqsController:Class

有任何想法吗?

最佳答案

使用I18n.t而不仅仅是 t .

关于ruby-on-rails - Admin::FaqsController:Class 的未定义方法 `t',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21878676/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com