I've this app on rails, where one of the form has a date_select field for a model and I'm trying to set a minimum date of today in that date_select field such that a user won't be able to select a date before today.
I'm able to fix start_year of the date_select field using this but unable to fix start month and start day for the field because there's not any start_month and start_day attributes available. Also what if I want to freeze some dates like user cannot select sundays then what to do?
Here's my form field looks like-
<%= form.label :Date %>
<%= form.date_select( :daterequired, start_year: Date.current.year,
order: [:day, :month, :year],
:class=>'form-control mb-1', id: :order_daterequired)%>
One more question-
If I've this form under the path app\views\order\_form.html.erb
and there are many other views in my app for example- app\views\services\index.html.erb
, app\views\pages\home.html.erb
all of these have many html.erb files. So my question is exactly where should I put a Javascript code if i'm using Javascript in any of these files under different views? Should I create different JS files for each html.erb file or just put all JS code in application.js file?
I know I'm asking for a lot but I'm learning this new framework and facing difficulties, Can anyone please help?