Date Searches

12 views
Skip to first unread message

Dennis Bulgatz

unread,
Apr 4, 2021, 10:32:47 PM4/4/21
to ActiveScaffold : Ruby on Rails Gem
Hi Sergio,

I noticed that Date searches were not working in one of my older applications (upgraded to Rails 6.0.3.x, ) and that the search UI widget was different.  The newer application, which uses the 'jquery-ui-rails' GEM renders a search select which allows a user to select PAST or FUTURE for a date search, and specify days/weeks, which is much easier than picking a date for the calendar picker.  Without the 'jquery-ui-rails', Date search ignores the date range. 

I know this is a confusing problem to remotely diagnose, but any advice?  Screen shot shows the behavior with Search working, using jquery-ui-rails.

If jquery-ui-rails is need by AS, would like to update the wiki.

Partial Gemfile List:
gem 'active_scaffold', '3.6.0.rc2' 
gem 'jquery-rails'
gem 'jquery-ui-rails'#needed for Date field searches to work
gem 'activemodel-serializers-xml', '~>1.0' #Used by Link Rules & Cradle Item Types services
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'mysql2', '>= 0.4.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'


Screen Shot 2021-04-04 at 9.30.40 PM.png

Sergio Cambra

unread,
Apr 8, 2021, 7:34:49 AM4/8/21
to ActiveScaffold : Ruby on Rails Gem, Dennis Bulgatz
Hi Dennis

Yes, you're right, it has been like that for a long time, or maybe always, I
don't remember.

When jquery-ui-rails is used, search_ui for date and datetime fields is set to
date_picker and datetime_picker, and there are some helpers rendering those
advanced search options (past, future, range, between, =, >, >=, <, <=, !=.
When jquery-ui-rails is not available, search_ui is nil, and helpers
active_scaffold_search_date or active_scaffold_search_datetime are used, which
will render 2 html5 date or datetime pickers (previously drop downs were used,
calling select_date helpers). I guess jquery-ui-rails should be only used to
change html5 date picker with jquery ui date picker, but there is no reason to
not supporting the other options without jquery ui.

This change would require some rewriting, moving code from bridges/shared/
date_bridge to search column helpers and active_scaffold/finder, and updating
date_picker bridge. You can open an issue on github, I can work on this for
next ActiveScaffold version, 3.7 or 4.0, which will support rails >= 5.2.
However I don't know when I will have time to change this, also you can work
on that change and send PR, I can review it and give some hints.
Reply all
Reply to author
Forward
0 new messages