Last active
August 29, 2015 14:18
-
-
Save pier-oliviert/96d1b968cbdbb22f1e50 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
class Post | |
def year | |
self.published_at.month | |
end | |
def month | |
self.published_at.month | |
end | |
def to_params | |
self.slug | |
end | |
end |
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
Application.routes.draw do | |
get '/:year/:month/:id', controller: :posts, action: :show, constraints: { year: /\d+/, month: /\d+/ }, as: "post" | |
end |
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
post_path(post) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment