0
如何在視圖圖層中提供以下方法?公開控制器的類方法來查看輔助方法?
# app/controllers/base_jobs_controller.rb
class BaseJobsController < ApplicationController
def self.filter_name
(controller_name.singularize + "_filter").to_sym
end
end
我想在這樣的視圖助手來使用它:
module ApplicationHelper
def filter_link(text, options = {})
# Need access to filter_name in here....
end
end