Skip to content

Instantly share code, notes, and snippets.

@bradfordw
Created November 18, 2009 17:50
Show Gist options
  • Select an option

  • Save bradfordw/238094 to your computer and use it in GitHub Desktop.

Select an option

Save bradfordw/238094 to your computer and use it in GitHub Desktop.
def authorized?
model = Kernel.const_get(params[:controller].classify)
model.first(:conditions => {:_id => current_user._id}).is_a?(model)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment