Created
September 28, 2012 08:56
-
-
Save leucos/3798737 to your computer and use it in GitHub Desktop.
Inject methods and routes in controller from helper
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
| class SomeStuff < Ramaze::Controller | |
| helper :versionner | |
| def index | |
| "Hello world" | |
| end | |
| end |
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 Ramaze | |
| module Helper | |
| module Versionner | |
| def self.included(c) | |
| Ramaze::Log.info "mixed into #{c}" | |
| c.class_eval { | |
| define_method(:version) { | |
| Ramaze::Log.info "In version" | |
| "3.1415" | |
| } | |
| } | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment