According to Indian financial year(April-1 to March-31), how do i get range when month changed to January my logic fails after 31 December, nothing is displayed.Here is my code for displaying all months: Model:
def self.get_month(month)
months={
'1'=> 'January',
'2'=> 'February',
'3'=> 'March',
'4'=> 'April',
'5'=> 'May',
'6'=> 'June',
'7'=> 'July',
'8'=> 'August',
'9'=> 'September',
'10'=> 'October',
'11'=> 'November',
'12' => 'December'
}
months[month]
end
views:
<% (current_financial_year.start_date.month..Date.today.month).times do |a| %>
<tr>
<td><%= PayrollDetails.get_month(a.to_s)%></td>
</tr>
<% end %>
This code works well up to December month but in January when year changed it displays nothing, i got this error:
undefined method `times' for 4..1:Range
how do i fix this revers range problem in rails3, thanks in advance.