Skip to content

Instantly share code, notes, and snippets.

@greenplastik
Created May 5, 2010 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenplastik/391067 to your computer and use it in GitHub Desktop.
Save greenplastik/391067 to your computer and use it in GitHub Desktop.
# Rails: 3.0.0.beta3
# Ruby: ruby-head
# from routes.rb:
match '/calendar(/:year/:month)', :to => 'calendar#index', :defaults => { :year => Time.zone.now.year, :month => Time.zone.now.month }
# from calendar_helper.rb:
def month_link(date)
link_to(I18n.localize(date, :format => "%B"), {:controller => "calendar", :action => "index", :year => date.year, :month => date.month})
end
# the links go only to /calendar. if I manually go to /calendar/2010/03, it works (it goes to March 2010).
# I've even tried changing the helper to try to force but the links still go only to /calendar:
def month_link(date)
link_to(I18n.localize(date, :format => "%B"), {:controller => "calendar", :action => "index", :year => 2010, :month => 1})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment