working basic state
This commit is contained in:
@@ -16,16 +16,12 @@ class DashboardController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def filter_records
|
def filter_records
|
||||||
records = Joint.all
|
if params.include?(:joint)
|
||||||
records = records.where(joint: params[:joint]) if params[:joint].present?
|
records = Joint.all
|
||||||
records
|
records = records.where(joint: params[:joint])
|
||||||
|
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
|
||||||
|
|||||||
@@ -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 %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user