working basic state
This commit is contained in:
@@ -16,16 +16,12 @@ class DashboardController < ApplicationController
|
||||
private
|
||||
|
||||
def filter_records
|
||||
if params.include?(:joint)
|
||||
records = Joint.all
|
||||
records = records.where(joint: params[:joint]) if params[:joint].present?
|
||||
records = records.where(joint: params[:joint])
|
||||
records
|
||||
else
|
||||
[]
|
||||
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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<%= form_with url: dashboard_path, method: :get, id: "filter-form" do |f| %>
|
||||
<div>
|
||||
<%= 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>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user