Skip to content

Commit 70c024d

Browse files
committed
docs: add rails4-autocomplete investigation for issue #2445
Documents the complete history and current state of the rails4-autocomplete gem, which has been non-functional since April 2022. Key findings: - Autocomplete was added in September 2015 and worked correctly - Accidentally broken during Bootstrap 5 migration in April 2022 (PR #1745) - All infrastructure (gem, routes, controller code) remains but is unused - Broken for nearly 3 years with no user complaints - Gem last updated April 2014 (12 years ago, unmaintained) Recommendation: Complete removal of the feature and all related code. Related: #2445
1 parent f7328d9 commit 70c024d

1 file changed

Lines changed: 279 additions & 0 deletions

File tree

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
# rails4-autocomplete Investigation
2+
3+
**Issue:** [#2445 - rails4-autocomplete removal or refactor](https://github.com/codebar/planner/issues/2445)
4+
5+
**Investigation Date:** February 8, 2026
6+
7+
**Summary:** The rails4-autocomplete gem (last updated April 2014) was accidentally broken during a Bootstrap 5 migration in April 2022 and has been non-functional for nearly 3 years. All infrastructure remains in place but is unused.
8+
9+
## Current State
10+
11+
### Where It's Referenced
12+
13+
1. **Gemfile (line 40)**
14+
```ruby
15+
gem 'rails4-autocomplete'
16+
```
17+
18+
2. **Gemfile.lock**
19+
- Version: 1.1.1 (last updated April 10, 2014 - 12 years ago)
20+
21+
3. **Controller (`app/controllers/members_controller.rb:8`)**
22+
```ruby
23+
autocomplete :skill, :name, class_name: 'ActsAsTaggableOn::Tag'
24+
```
25+
26+
4. **Routes (`config/routes.rb:29`)**
27+
```ruby
28+
get :autocomplete_skill_name, on: :collection
29+
```
30+
31+
5. **JavaScript (`app/assets/javascripts/application.js:19`)**
32+
```javascript
33+
//= require autocomplete-rails
34+
```
35+
36+
6. **View (`app/views/members/_new.html.haml:22`)**
37+
```haml
38+
= f.input :skill_list, input_html: { value: @member.skill_list.join(", ") }
39+
```
40+
41+
### Why It's Not Working
42+
43+
The view uses a plain `f.input :skill_list` field, but rails4-autocomplete requires using special helper methods like `autocomplete_field_tag` or specifying `as: :autocomplete` in the form input options.
44+
45+
The current implementation renders a regular text input without:
46+
- The `as: :autocomplete` parameter
47+
- The `url: autocomplete_skill_name_members_path` parameter
48+
- Any `data-autocomplete` attributes
49+
- JavaScript bindings to trigger autocomplete
50+
51+
The endpoint `/members/autocomplete_skill_name` exists but has never been wired up to the current frontend.
52+
53+
## Historical Timeline
54+
55+
### Phase 1: Initial Skills Feature (August 24, 2015)
56+
57+
**Commit:** `185eddd3` by Margo Urey
58+
59+
Added the basic skills feature:
60+
- Installed `acts-as-taggable-on` gem
61+
- Added migrations for tagging tables
62+
- Added `skill_list` field to member form
63+
- Field was a **plain text input** with manual comma-separated entry
64+
65+
Form code:
66+
```haml
67+
= f.input :skill_list, label: "Skills, enter as a comma separated list"
68+
```
69+
70+
### Phase 2: Autocomplete Added (September 25, 2015)
71+
72+
**Commit:** `92f6df774c84803052496265dc3aff363530572c` by Margo Urey
73+
74+
Enhanced the feature with autocomplete:
75+
76+
**Changes:**
77+
- Added `rails4-autocomplete` gem (v1.1.1)
78+
- Added `jquery-ui-rails` gem (~> 5.0.0)
79+
- Modified form to use autocomplete:
80+
81+
```haml
82+
= f.input :skill_list,
83+
label: "Skills, enter as a comma separated list",
84+
url: autocomplete_skill_name_members_path,
85+
as: :autocomplete,
86+
input_html: {'data-delimiter' => ','}
87+
```
88+
89+
- Added controller method: `autocomplete :skill, :name, class_name: 'ActsAsTaggableOn::Tag'`
90+
- Added route: `get :autocomplete_skill_name, on: :collection`
91+
- Added JavaScript requires: `jquery-ui` and `autocomplete-rails`
92+
- Added CSS: `jquery-ui` stylesheet
93+
94+
**Status:** ✅ Autocomplete was fully functional at this point
95+
96+
### Phase 3: Accidental Removal (April 15, 2022)
97+
98+
**Commit:** `b3cbd73070a05870e0c451eab9df31daf364ec9a` by Kriszta Matyi
99+
100+
**PR:** [#1745 - Migrate member (public) forms to Bootstrap 5 classes](https://github.com/codebar/planner/pull/1745)
101+
102+
**Merged:** May 6, 2022
103+
104+
During Bootstrap 5 migration:
105+
- Deleted `app/views/members/_form.html.haml` entirely
106+
- Rewrote form in `_new.html.haml` from scratch
107+
- Lost the autocomplete parameters:
108+
109+
```haml
110+
# Before (working):
111+
= f.input :skill_list,
112+
label: 'Skills, enter as a comma separated list',
113+
url: autocomplete_skill_name_members_path,
114+
as: :autocomplete,
115+
input_html: {'data-delimiter' => ','}
116+
117+
# After (broken):
118+
= f.input :skill_list,
119+
label: 'Skills, enter as a comma separated list',
120+
input_html: { value: @member.skill_list.join(", ") }
121+
```
122+
123+
**What Remained:**
124+
- rails4-autocomplete gem (zombie dependency)
125+
- Controller autocomplete method (unused)
126+
- Route definition (dead endpoint)
127+
- JavaScript requires (loaded but never invoked)
128+
129+
**Status:** ❌ Autocomplete has been broken ever since (nearly 3 years)
130+
131+
## Why This Went Unnoticed
132+
133+
1. **No Tests:** Zero test coverage for autocomplete functionality
134+
2. **No Monitoring:** No error tracking since the endpoint is simply never called
135+
3. **Silent Degradation:** Form still works, just without autocomplete suggestions
136+
4. **Limited Usage:** Only affects coaches editing their skill list
137+
5. **Manual Entry Works:** Users can still enter comma-separated skills
138+
139+
## Technical Debt Assessment
140+
141+
### The Gem: rails4-autocomplete
142+
143+
- **Last Updated:** April 10, 2014 (12 years ago)
144+
- **Rails Version:** Designed for Rails 4.x
145+
- **Current Rails:** Application is on Rails 8.1.2
146+
- **Maintenance:** Abandoned, no security updates
147+
- **Dependencies:** Requires jQuery-UI (also legacy)
148+
149+
### The Infrastructure
150+
151+
**Dead Code:**
152+
- Gem dependency (unused)
153+
- Controller method (never called)
154+
- Route (dead endpoint)
155+
- JavaScript asset (loaded but inactive)
156+
- jQuery-UI dependency (partially for this feature)
157+
158+
**Still Referenced:**
159+
- `skill_list` field works without autocomplete
160+
- Tags stored in `acts-as-taggable-on` tables
161+
- Model scopes: `Member.with_skill(skill_name)`
162+
163+
## Recommendations
164+
165+
### Option 1: Complete Removal (Recommended)
166+
167+
Remove all autocomplete infrastructure since it's been non-functional for 3 years with no user complaints.
168+
169+
**Benefits:**
170+
- Removes unmaintained dependency
171+
- Cleans up dead code
172+
- Simplifies asset pipeline
173+
- No functionality loss (already broken)
174+
175+
**To Remove:**
176+
- Gem: `rails4-autocomplete` from Gemfile
177+
- Gem: `jquery-ui-rails` from Gemfile (confirmed single-purpose dependency, see below)
178+
- Controller: `autocomplete :skill, :name, class_name: 'ActsAsTaggableOn::Tag'` line
179+
- Route: `get :autocomplete_skill_name, on: :collection`
180+
- JavaScript: `//= require autocomplete-rails` line
181+
- JavaScript: `//= require jquery-ui` line
182+
- CSS: `*= require jquery-ui` line
183+
184+
**To Keep:**
185+
- `acts-as-taggable-on` gem (still actively used)
186+
- `skill_list` field (works with manual entry)
187+
- Member model tagging functionality
188+
189+
### Option 2: Restore with Modern Alternative
190+
191+
If autocomplete is deemed valuable, reimplement using modern tools.
192+
193+
**Options:**
194+
- [Stimulus Autocomplete](https://github.com/afcapel/stimulus-autocomplete)
195+
- [TomSelect](https://tom-select.js.org/) (modern replacement for Chosen/Select2)
196+
- HTML5 `<datalist>` element (native browser autocomplete)
197+
198+
**Considerations:**
199+
- Requires development effort
200+
- Needs testing coverage
201+
- User benefit unclear (no requests for 3 years)
202+
- May conflict with existing Stimulus/Turbo setup
203+
204+
## Evidence
205+
206+
### Git Commits
207+
208+
```bash
209+
# Added autocomplete (Sep 25, 2015)
210+
git show 92f6df774c84803052496265dc3aff363530572c
211+
212+
# Broke autocomplete (Apr 15, 2022)
213+
git show b3cbd73070a05870e0c451eab9df31daf364ec9a
214+
215+
# Original skill feature (Aug 24, 2015)
216+
git show 185eddd3
217+
```
218+
219+
### Testing Locally
220+
221+
The endpoint exists but returns empty since it's never configured on the frontend:
222+
223+
```bash
224+
curl http://localhost:3000/members/autocomplete_skill_name?term=ruby
225+
# Returns: []
226+
```
227+
228+
The form field renders as a plain `<input type="text">` with no autocomplete attributes.
229+
230+
## jquery-ui-rails Analysis
231+
232+
### Investigation (February 8, 2026)
233+
234+
**Question:** Can jquery-ui-rails be safely removed?
235+
236+
**Answer:** Yes, with 95%+ confidence.
237+
238+
**Evidence:**
239+
- Added in the same commit as rails4-autocomplete (Sep 25, 2015, commit `92f6df77`)
240+
- Added exclusively for the autocomplete feature
241+
- Comprehensive code search found **zero usage**:
242+
- No jQuery UI JavaScript methods (`.datepicker()`, `.autocomplete()`, `.sortable()`, etc.)
243+
- No jQuery UI CSS classes (`ui-widget`, `ui-state-*`, etc.)
244+
- No data attributes for jQuery UI
245+
- No dynamic JavaScript generating jQuery UI code
246+
- **Bundle size impact**: ~120KB saved from production assets
247+
- No other gems depend on it (checked chosen-rails, pickadate-rails)
248+
- The app uses alternatives:
249+
- pickadate-rails for date picking
250+
- chosen-rails for select boxes
251+
- Bootstrap 5 for UI components
252+
253+
**Risk Assessment:**
254+
- **LOW RISK** - Feature broken for 3 years with no incidents
255+
- If anything used jQuery UI, it would have broken in 2022
256+
- Modern Stimulus/Turbo stack doesn't use jQuery UI patterns
257+
258+
**Files requiring jquery-ui:**
259+
1. Gemfile (line 26): `gem 'jquery-ui-rails'`
260+
2. app/assets/javascripts/application.js (line 18): `//= require jquery-ui`
261+
3. app/assets/stylesheets/application.scss (line 18): `*= require jquery-ui`
262+
263+
**Conclusion:** Safe to remove completely alongside rails4-autocomplete.
264+
265+
## Conclusion
266+
267+
The rails4-autocomplete feature was:
268+
1. Added in September 2015 and worked correctly
269+
2. Accidentally broken in April 2022 during Bootstrap 5 migration
270+
3. Remained broken for nearly 3 years without user reports
271+
4. Depends on a 12-year-old unmaintained gem
272+
5. Represents pure technical debt with no active functionality
273+
274+
The jquery-ui-rails dependency was:
275+
1. Added specifically for rails4-autocomplete (same commit)
276+
2. Never used for any other purpose
277+
3. Safe to remove with minimal risk
278+
279+
**Recommendation:** Proceed with complete removal of both gems as outlined in Option 1.

0 commit comments

Comments
 (0)