SO I have been learning ror and trying out some form examples.
Most of the examples in the web is in erb format and my files are in .haml format. I am trying to a write a static dob field where it takes day,time,year.
view
%label{:for => "patient_dob"} DOB
%date_select {Date.today,start_year => getBirthDateStart(), :end_year => getBirthDateEnd() }
module ApplicationHelper
def getBirthDateStart()
Time.now.year - 100
end
def getBirthDateEnd()
Time.now.year
end
end
I know my code doesn’t make much sense, but hope it explains what I am trying to do. Can someone point me to the correct direction.
“%date_select” is not an HTML element. You’ll use “%” to create things like %title, %p
You’ll want to use “%” to create HTML directly. In this case, you’d use “%select”% to create s select box. In Ruby on Rails, you have form helper that you’ll call to create collections like this.
Docs: http://apidock.com/rails/ActionView/Helpers/DateHelper/date_select