Created
March 14, 2010 02:54
-
-
Save lxneng/331737 to your computer and use it in GitHub Desktop.
Use rails date_select without activerecord model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#controller | |
@start_date = Date.civil(params[:range][:"start_date(1i)"].to_i,params[:range][:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i) | |
#view | |
<%= date_select('range', 'start_date', :order => [:month, :day, :year])%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And if you want to keep the value in that date select after submit.. ad the following line to your controller
@range = Struct.new(:start_date).new(@start_date)