Skip to content

Instantly share code, notes, and snippets.

@rociiu
Created October 24, 2009 11:59
Show Gist options
  • Save rociiu/217495 to your computer and use it in GitHub Desktop.
Save rociiu/217495 to your computer and use it in GitHub Desktop.
def custom_link_to(post)
"<a href='/blog/#{post.datetime.year}/#{post.datetime.month}/#{post.datetime.day}/#{post.slug}'>post.title</a>"
end
#routes
"/blog/:year", :controller => 'posts', :action => 'posts_for_year'
#controller actions
def posts_for_year
@posts = Post.find_by_year(params[:year])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment