Skip to content

Instantly share code, notes, and snippets.

@rjfranco
Created December 21, 2011 00:21
Show Gist options
  • Save rjfranco/1503933 to your computer and use it in GitHub Desktop.
Save rjfranco/1503933 to your computer and use it in GitHub Desktop.
use variable as method name
# 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
@rjfranco
Copy link
Author

Uhg turned out to be a terrible idea, looking at trying send instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment