-
-
Save nononoy/4b9f2474dcd477d5b4a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module BeforeRender | |
| extend ActiveSupport::Concern | |
| included do | |
| define_callbacks :render | |
| end | |
| def render(*args, &block) | |
| run_callbacks(:render) do | |
| super | |
| end | |
| end | |
| module ClassMethods | |
| def before_render(*names, &blk) | |
| _insert_callbacks(names, blk) do |name, options| | |
| set_callback(:render, :before, name, options) | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment