Search code examples
ruby-on-railsruby-on-rails-3ruby-on-rails-4rails-i18n

undefined method `t' for Admin::FaqsController:Class


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?


Solution

  • Use I18n.t instead of just t.