Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/halogenandtoast/presentable

Simple presenters for rails.
https://github.com/halogenandtoast/presentable

Last synced: 3 months ago
JSON representation

Simple presenters for rails.

Awesome Lists containing this project

README

        

h1. Presentable

Making presenters easy and fun!

h2. Setup for Rails

h3. Update config/environment.rb

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

h3. Create a presenter class

class PostPresenter < Presenter

def title
"#{original_title} - #{created_at.strftime('%B %d')}" # reference old values by prefixing them with original_
end
end

h3. Call present on your instance

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

h3. Use presenter methods in your view

<%= @post.title %>


@post.body