Module: PostsHelper

Defined in:
app/helpers/posts_helper.rb

Instance Method Summary collapse

Instance Method Details

#post_path(post) ⇒ Object

Override post_path helper to generate Wordpress-style permalinks for published posts.


4
5
6
7
8
9
10
# File 'app/helpers/posts_helper.rb', line 4

def post_path(post)
  if post.published?
    "/#{post.published_at_slug}/#{post.slug}/"
  else
    "/posts/#{post.id}"
  end
end