jeudi 7 mai 2015

undefined method `content_for' in presenter rails

I am using a presenter for a view in rails to display data which is saved in a yml file. (i18n gem)

This is the controller-

class DocumentsController < ApplicationController
      def index
        @presenter = DocumentPresenter.new
      end
    end

This is my view-

= @presenter.viewname

and this is my presenter-

 class DocumentPresenter
  def viewname
      content_for :secondary_nav_title do
         t('Documents')
      end
  end
end

The error say : undefined method `content_for' Why does rails not recognize content_for in the presenter? or am i doing something wrong entirely? Thanks!




Aucun commentaire:

Enregistrer un commentaire