in my project i have controller in namespace admin and I'm using breadcrumbs_on_rails to build breadcrums. My controller looks like: module Admin
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
i can use t method in new, edit and other controller action but when this 't' is not in the controller action i have the follwoing error:
undefined method `t' for Admin::FaqsController:Class
Any ideas?
Use I18n.t
instead of just t
.
I can suggest to extend your class with
extend ActionView::Helpers::TranslationHelper
It will allow you to use #t
and #l
helpers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With