Displaying 1 result from an estimated 1 matches for "regex_str".
2007 Jun 12
1
Route Regex Requirement not working properly
...ller => ''downloads'', :action
=> ''list_downloads_for_category'', :requirements => {:category =>
DownloadableFileCategory.category_regex}
And here''s the method definition for
DownloadableFileCategory.category_regex:
def self.category_regex
regex_str = ""
for category in DownloadableFileCategory.find(:all)
regex_str += category.category.downcase
regex_str += "|"
end
Regexp.new(regex_str.chop, Regexp::IGNORECASE)
end
This creates a regex such as /admissions|jobs/i so that the url
/admissions/download...