Skip to content

Commit

Permalink
[padrino-core] Added regex support in routes
Browse files Browse the repository at this point in the history
[padrino-core] Removed some deprecations
  • Loading branch information
DAddYE committed Jul 16, 2010
1 parent 16b79e3 commit 2629d81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

== 0.9.15 (Unreleased)

* Added regex support in routes
* Removed some deprecations
* Fixes options_for_select helper selected logic and added test
* Added Before/After load hooks
* Fixes DataMapper.finalize
Expand Down
20 changes: 4 additions & 16 deletions padrino-core/lib/padrino-core/application/routing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ def route(verb, path, options={}, &block)

# HTTPRouter route construction
route = case path
when Regexp
router.add('/?').partial.arbitrary{|request| request.env['PATH_INFO'] =~ path}
else
router.add(path)
when Regexp
router.add('/?').partial.arbitrary { |request| request.env['PATH_INFO'] =~ path }
else
router.add(path)
end

route.name(name) if name
Expand Down Expand Up @@ -282,18 +282,6 @@ def parse_route(path, options, verb)
end

if path.kind_of?(String) # path i.e "/index" or "/show"
# Backwards compatability

if path == '(/)'
path = '/'
warn "WARNING! #{Padrino.first_caller}: #{verb} (/) is deprecated, simply use / instead" if verb != "HEAD"
end

if path =~ /\(\/\)$/
path.gsub(/\(\/\)$/, '/?')
warn "WARNING! #{Padrino.first_caller}: #{verb} (/) is deprecated, simply use /? instead" if verb != "HEAD"
end

# Now we need to parse our 'with' params
if with_params = options.delete(:with)
path = process_path_for_with_params(path, with_params)
Expand Down

0 comments on commit 2629d81

Please sign in to comment.