README.md in easy_presenter-1.0.0 vs README.md in easy_presenter-1.0.1

- old
+ new

@@ -1,8 +1,8 @@ # EasyPresenter -Access view methods from the context of your model. +Access view methods from the context of your `Ruby on Rails` model. ## Usage ### Easy ``` gem 'easy_presenter' @@ -53,13 +53,51 @@ ### Supported ORMs `ActiveRecord`, `Mongoid`, you may add support to an ORM at the bottom of `lib/easy_presenter.rb` and send in a pull request if you wish. ### Advanced -You may use the following modules to add EasyPresenter to other classes. +You may `include` the following modules to add EasyPresenter to other classes. +* `easy_presenter_subclass` - for handling subclasses * `EasyPresenter::Base` - add access to view methods * `EasyPresenter` - `EasyPresenter::Base` and if `method_missing?`, give access to the `ClassNamePresenter` class + + +To add access to view methods to all instances or subclasses (such as an ORM). +```ruby +# config/initializers/add_presenter_to_orm.rb +# Find the base or shared class, for `ActiveRecord` it's `ActiveRecord::Base` and `Mongoid` it's `Mongoid::Document` +Orm::BaseClass.send :include, EasyPresenter +``` + +For all instances of a basic class. +```ruby +# app/models/non_database_model.rb +class NonDatabaseModel + include EasyPresenter +end + +# app/presenters/non_database_model_presenter.rb +module NonDatabaseModelPresenter + ... + + module ClassMethods + ... + end +end +``` + +For all instances of a basic class without need of a `ClassNamePresenter` class. +```ruby +# app/models/some_view_object.rb +class SomeViewObject + include EasyPresenter::Base + + def random_link + link_to "random", "http://www.random.com" + end +end +``` ## Credits Extracted out of [Placemark](https://www.placemarkhq.com/). ### Contribution \ No newline at end of file