Created
February 13, 2010 23:38
-
-
Save pjg/303742 to your computer and use it in GitHub Desktop.
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
def default_url_options(options = {}) | |
# resource hack so that url_for(@post) works like it should | |
# if a post was given as a parameter to `post_path` it will be assigned to the first (unnassigned) parameter of the route (year) | |
if options[:controller] == "posts" && options[:year].is_a?(Post) | |
post = options[:year] | |
options[:year] = post.year | |
options.merge(:month => post.month, :slug => post.slug) | |
else | |
{} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment