如何在rails 4中设置默认值。我正在尝试
filter :by_resolved_at_in, as: :date_range,label: "Filtro Resolvido em", :value => Time.now.strftime('%Y-%m-%d')
答案 0 :(得分:0)
这是ActiveAdmin
,对吧?
您无法在filter
行中执行此操作,但可以定义一个before_filter
,其中初始化了搜索范围。
before_filter :only => [:index] do
if params['commit'].blank?
params['q'] = {by_resolved_at_in: Date.today..Date.today}
end
end