Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/halogenandtoast/presentable
- Owner: halogenandtoast
- Created: 2010-02-10T19:55:08.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-02-10T20:00:37.000Z (almost 15 years ago)
- Last Synced: 2023-03-10T23:24:22.544Z (almost 2 years ago)
- Language: Ruby
- Homepage: https://github.com/halogenandtoast/presentable
- Size: 89.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.textile
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
endh3. Call present on your instance
@post = Post.find(params[:id]).presenterh3. Use presenter methods in your view
<%= @post.title %>
@post.body