Im making a calendar to display some entries and it needs to select the month and year, i use this in the controller to achive that:
def index
@month=params[:month].to_i || Time.now.month
@year=params[:year].to_i || Time.now.year
@months=[nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
end
When you dont specify a month/year it works fine but when you go to /controller?month=2 it just errors saying "argument out of range" for:
<% offset=Time.parse("1/#{@month}/#{@year}").wday-1 %>
i assume its because its giving the character code instead of 2, but "2".to_i in irb returns 2.
anyone know how to solve this?