Wednesday, May 28, 2014 Accessing a URL or path directly from a model can help to remove repetition in code. Consider the following: # config/routes.rb get 'posts/:segment/:slug', to: 'posts#show', as: :post # app/views/posts/_preview.html.haml - @posts.each do |post| - # <a href='/posts/2014-05-27/an-example-post'>An Example Post</a> = link_to post.title, posts_path(post, segment: post.segment, s