working basic state

This commit is contained in:
2026-07-27 21:55:41 -06:00
parent 0b4532282d
commit 7ebf6dbf41
2 changed files with 8 additions and 12 deletions
+5 -9
View File
@@ -16,16 +16,12 @@ class DashboardController < ApplicationController
private private
def filter_records def filter_records
if params.include?(:joint)
records = Joint.all records = Joint.all
records = records.where(joint: params[:joint]) if params[:joint].present? records = records.where(joint: params[:joint])
records records
else
[]
end
end end
# old broken: def index
# old broken: @joint = Joint.distinct.pluck(:Joint)
# old broken:
# old broken: @records = Joint.all
# old broken:
# old broken: @records = @records.where(Joint: params[joint]) if params[:joint].present?
# old broken: end
end end
+1 -1
View File
@@ -4,7 +4,7 @@
<%= form_with url: dashboard_path, method: :get, id: "filter-form" do |f| %> <%= form_with url: dashboard_path, method: :get, id: "filter-form" do |f| %>
<div> <div>
<%= f.label :joint, "Select Joint:" %> <%= f.label :joint, "Select Joint:" %>
<%= f.select :joint, options_for_select(@available_joints, params[:joint]), include_blank: "All joints", id: "joint" %> <%= f.select :joint, options_for_select(@available_joints, params[:joint]), include_blank: "Select a joint", id: "joint" %>
</div> </div>
<% end %> <% end %>