Rails view helpers in helper file

后端 未结 3 2264
星月不相逢
星月不相逢 2020-12-13 20:27

I\'m probably missing something obvious here but here\'s what I\'m trying to do.

From the view, I\'m calling a custom helper function

3条回答
  •  悲哀的现实
    2020-12-13 21:11

    IMHO, you should not have HTML hardcoded in Ruby code. Instead, prefer partials views.

    module ServicesHelper
      def display_services(user)
        render :partial => "shared/display_services", :locals => {:user => user}
      end
    end
    

提交回复
热议问题