如何在Rails 4中设置默认值?
filter :by_resolved_at_in, as: :date_range,label: "Filtro Resolvido em", :value => Time.now.strftime('%Y-%m-%d')
This is ActiveAdmin
, right?
You can't do this in the filter
line but you can define a before_filter
where the ransack values are initialized.
before_filter :only => [:index] do
if params['commit'].blank?
params['q'] = {by_resolved_at_in: Date.today..Date.today}
end
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.