Skip to content

Instantly share code, notes, and snippets.

@balepc
Created September 2, 2009 11:59
Show Gist options
  • Save balepc/179676 to your computer and use it in GitHub Desktop.
Save balepc/179676 to your computer and use it in GitHub Desktop.
class EventController
...
def index
@month = current_month
@year = current_year
if @month == 1
@previous_month = 12
@previous_year = @year - 1
@next_month = 2
@next_year = @year
elsif @month == 12
@previous_month = 11
@previous_year = @year
@next_month = 1
@next_year = @year + 1
else
@previous_month = @month - 1
@previous_year = @year
@next_month = @month + 1
@next_year = @year
end
...
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment