Sha256: 46c3b8f4732d30772f1476439e68976ef39d81c467cbbe57ca8cc42a519642aa
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
= Rails Engine Decorators Extend Rails Engine's business logic (models, controllers, helpers, etc.) easily from your application or other engine. This solution was first implemented in the Forem engine, see https://github.com/radar/forem/pull/260 == Authors * Kunal Chaudhari, https://github.com/kunalchaudhari * Ryan Bigg, https://github.com/radar * Philip Arndt, https://github.com/parndt * Antonio Tapiador, https://github.com/atd == Usage (From Forem's patch): Standard practice for including such changes in your application or extension is to create a file within the relevant app/models or app/controllers directory with the original class name with _decorator appended. ### Adding a custom method to the Post model: # app/decorators/models/forem/post_decorator.rb Forem::Post.class_eval do def some_method ... end end ### Adding a custom method to the PostsController: # app/decorators/controllers/forem/posts_controller_decorator.rb Forem::PostsController.class_eval do def some_action ... end end The exact same format can be used to redefine an existing method.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_engine_decorators-1.0.0 | README.rdoc |