Skip to content

Instantly share code, notes, and snippets.

@Sailias
Created April 29, 2010 14:52
Show Gist options
  • Save Sailias/383718 to your computer and use it in GitHub Desktop.
Save Sailias/383718 to your computer and use it in GitHub Desktop.
1. def find_commentable
2. params.each do |name, value|
3. if name =~ /(.+)_id$/
4. return $1.classify.constantize.find(value)
5. end
6. end
7. nil
8. end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment