Sha256: 4c2fdefe056809f67639a55419a0cb1a99d03d974ff1455f807e7a6c9a7420d1
Contents?: true
Size: 925 Bytes
Versions: 1
Compression:
Stored size: 925 Bytes
Contents
# BasePresenter The gem adds "Presenter" functionality into Rails application. ## Installation Add this line to your application's Gemfile: gem 'base_presenter' And then execute: $ bundle Or install it yourself as: $ gem install base_presenter ## Usage In director root_rails/app/presenters create file example_presenter.rb with content ```ruby class ExamplePresenter < BasePresenter presents :example delegate :name, :example def name "Name" end def self.class_name "Example" end end ``` and in file show.html.erb with: * object `@example` ```erb <% present @example do |presenter| %> Name: <%= presenter.name %> <% end %> ``` * class `Example` ```erb <% present Example do |presenter| %> Class name: <%= presenter.class_name %> <% end %> ``` ## Methods Methods of BasePresenter Method returns span with 'None given' when value is blank ```erb #handle_none(value) ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
base_presenter-0.0.6 | README.md |