I'm trying to write a function that will accept a rails URL, and see if it matches one of my Rights. Rights are just controller URLs, so I can manage access at the controller level (don't need action level). What I'm trying to do is take the url passed, and see if its access controlled. If it is, the method should stop and return true, if not it will return false. This method is used to check when someone logs out if they can be redirected to where they are, or if they need to be redirected to the home URL, it protects from an infinite login loop.

# true if this is a protected url that would cause a login loop
def looper_url?(url)
  rights = Right.find(:all)
  for right in rights
  if url_for(right) == url
    return true
This is what I came up with, it doesn't work but it should be pretty enough to give you an idea of what I'm trying to do. I think the problem is just in my inner most if block, not sure how to stop the loop and return true.