Results 1 to 3 of 3
Jan 8, 2007, 17:23 #1
[rails] Trouble writing a loop that will stop execution
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 exit end end