Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple presenters for rails.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails
test
.gitignore
Rakefile
Readme.textile
VERSION
presentable.gemspec

Readme.textile

Presentable

Making presenters easy and fun!

Setup for Rails

Update config/environment.rb

config.load_paths += %W( #{RAILS_ROOT}/app/presenters )

Create a presenter class

class PostPresenter < Presenter
  def title
    "#{original_title} - <span class='date'>#{created_at.strftime('%B %d')}</span>" # reference old values by prefixing them with original_
  end
end

Call present on your instance

@post = Post.find(params[:id]).presenter

Use presenter methods in your view

<h2><%= @post.title %></h2>
<p>@post.body</p>
Something went wrong with that request. Please try again.