Created
December 21, 2011 00:21
-
-
Save rjfranco/1503933 to your computer and use it in GitHub Desktop.
use variable as method name
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
# trying to get "entity" to act as whatever you pass to method, so if you pass person @event.person would be returned. | |
# below is what I ended up using, just in case anyone else runs into this >.> | |
def get_scope(entity) | |
entity = entity.pluralize.downcase.to_sym | |
@event.send entity | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uhg turned out to be a terrible idea, looking at trying send instead