i using presenter view in rails display data saved in yml file. (i18n gem)
this controller-
class documentscontroller < applicationcontroller def index @presenter = documentpresenter.new end end
this view-
= @presenter.viewname
and presenter-
class documentpresenter def viewname content_for :secondary_nav_title t('documents') end end end
the error says:
undefined method `content_for'
why doesn't rails recognize content_for
in presenter?
the content_for helper method should not used in model violates mvc pattern.
if must use it, though not reccomended, can add @ bottom of model.
def helpers actioncontroller::base.helpers end
then call content_for use
class documentpresenter def viewname helpers.content_for :secondary_nav_title t('documents') end end end
Comments
Post a Comment