I have a table already being rendered with a bunch of data, Including dates.
Here is some of the code i have ready for a search.
<%= form_for :search, method: :get do |f| %>
<%= f.date_field :start_date, value: @start %>
<%= f.date_field :end_date, value: @end %>
<%= f.submit 'Search' %>
<% end %>
And this is in my controller
@start = selected_date(:start_date)
@end = selected_date(:end_date)
@eventsdate = params[:search].present? ? Event.where(@start..@end) : Event.none
end
private
def selected_date(symbol)
params[:search].present? && params[:search][symbol].present? ? params[:search][symbol].to_date : Time.now.to_date
end
What I want is a simple date filter. What can i do to get this to work? The table has one column with a bunch of dates in, Basically just need to get the dates within range
The reason why @eventsdate exists is because i was going to have it as a render on search, which is no good as i need the table to exist beforehand for the text search