Skip to content

aosmith/simple-presenters

Repository files navigation

simple-presenters

<img src=“https://travis-ci.org/aosmith/simple-presenters.png?branch=master” />

Usage

Include SimplePresenters::Presenter in your presenter:

module UserPresenter
  include SimplePresenters::Presenter

  def default
    [:name, :email]
  end
end

Include your presenter in your model:

class User < ActiveRecord::Base
  include UserPresenter
  ...
end

Protecting Attributes

Add a class method on your model called filtered_parameters:

class User < ActiveRecord::Base
  include UserPresenter

  def self.filtered_parameters
    [:authentication_token, :password_digest, :salt]
  end
end

Notes for version 0.0.5

Added / Fixed functionality around arrays.

About

A simple rails presenter gem.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages