Add Topic#url for determining url for a Topic

This commit is contained in:
Chris Hunt 2013-05-25 17:38:15 -07:00
parent f2b5e20840
commit b8fbac582e

View file

@ -682,6 +682,10 @@ class Topic < ActiveRecord::Base
url
end
def url(post_number = nil)
self.class.url id, slug, post_number
end
def relative_url(post_number=nil)
url = "/t/#{slug}/#{id}"
url << "/#{post_number}" if post_number.to_i > 1