https://github.com/blaknite/blush
View-Models for Rails.
https://github.com/blaknite/blush
decorators presenters rails view-model
Last synced: about 1 year ago
JSON representation
View-Models for Rails.
- Host: GitHub
- URL: https://github.com/blaknite/blush
- Owner: blaknite
- License: mit
- Created: 2016-05-16T08:05:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-27T12:36:10.000Z (over 6 years ago)
- Last Synced: 2024-12-20T15:50:00.213Z (over 1 year ago)
- Topics: decorators, presenters, rails, view-model
- Language: Ruby
- Homepage:
- Size: 13.7 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Blush
View-Models for Rails.
## Installation
```ruby
gem 'blush'
```
## Usage
```ruby
class Comment < ActiveRecord::Base
has_presenter
end
class CommentPresenter < Blush::Presenter
def content
h.simple_format(object.content)
end
end
# explicitly call the presenter methods
@comment.presenter.content
# delegate to the model if method doesn't exist on presenter
@comment.present(:content)
```