1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

17 commits

Author SHA1 Message Date
Aaron Patterson
7187339854 make the routes reader private
nobody should be touching the routes hash without going through the
NamedRouteCollection object.
2015-08-18 16:33:18 -07:00
Rafael Mendonça França
bb6fe7e73a Consistent usage of spaces in hashes across our codebase 2015-01-29 12:19:41 -02:00
Kir Shatrov
baf14ae513 Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration
Non-kwargs requests are deprecated now.
Guides are updated as well.

`post url, nil, nil, { a: 'b' }` doesn't make sense.
`post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
2015-01-29 14:44:46 +02:00
Aaron Patterson
4a7b95985f Rails-ish apps should descend from Rails::Railtie
Use an is_a check to ensure it's a Railsish app so we can avoid
respond_to calls everywhere.
2014-07-16 15:41:47 -07:00
Aaron Patterson
09eeb3fc04 always test against a routed rack app so there are always url_helpers 2014-07-07 10:22:13 -07:00
Larry Lv
4a9d4c85c3 Fix request's path_info when a rack app mounted at '/'.
Fixes issue #15511.
2014-06-14 04:57:33 +08:00
Piotr Sarnacki
2e0f9ed76e Revert "Don't remove trailing slash from PATH_INFO for mounted apps"
The revert is needed because of a regression described in #13369, routes
with trailing slash are no longer recognized properly.

This reverts commit 50311f1391.
2014-01-16 10:13:51 +01:00
Piotr Sarnacki
e6c602da90 Fix mounting engines inside a resources block
When a route is mounted inside a resources block, it's automatically
prefixed, so a following code:

    resources :users do
      mount Blog::Engine => '/blog'
    end

will generate a user_blog path helper.

In order to access engine helpers, we also use "mounted_helpers", a list
of helpers associated with each mounted engine, so a path to blog's post
can be generated using user_blog.post_path(user, post).

The problem I'm fixing here is that mount used a raw :as option, without
taking nestings into account. As a result, blog was added to a route set
as a `user_blog`, but helper was generated for just `blog`.

This commit applies the proper logic for defining a helper for a mounted
engine nested in resources or resource block.

(closes #8533)
2013-12-10 21:38:41 +01:00
Piotr Sarnacki
50311f1391 Don't remove trailing slash from PATH_INFO for mounted apps
Previously when app was mounted as following:

    class Foo
      def call(env)
        [200, {}, [env['PATH_INFO']]]
      end
    end

    RackMountRailsBug::Application.routes.draw do
      mount RackTest.new => "/foo"
    end

trailing slash was removed from PATH_INFO. For example requesting

    GET /foo/bar/

on routes defined above would result in a response containing "/foo/bar"
instead of "/foo/bar/".

This commit fixes the issue.

(closes #3215)
2013-06-21 08:56:19 +02:00
Jeremy Kemper
32ec8eb91d Update tests for #9704, named route collisions
* Fix named route collision in mount test fixture
* Update controller named route precedence test
2013-03-24 23:30:44 -07:00
Pratik Naik
6a5d1c765f Make sure :via works with mount 2012-08-20 10:25:23 -05:00
Jeremy Kemper
4d0e6db9ec Add passing tests for generating URLs with nested SCRIPT_NAMEs 2012-05-07 14:53:57 -07:00
Aaron Patterson
9d0789c415 adding tests for #4029 2011-12-19 13:34:54 -08:00
José Valim
28cf77203b Check if the routes object really responds to define_mount_prefix. 2010-12-09 13:15:25 +01:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
José Valim
839362fa07 Make all AP tests pass for Ruby 1.9.1. 2010-03-12 11:50:45 +01:00
Carlhuda
f38e2e0335 Add support for mount RackApp, :at => "/sprockets" with a shorthand of mount Sprockets => "/sprockets".
This is different from the match syntax in that it cannot be used for controller/action and it does not 
assume an anchor at the end of the match. 

For instance, in the above example, if the client asked for "/sprockets/foo.js", the Sprockets app would
have a SCRIPT_NAME of "/sprockets" and PATH_INFO of "/foo.js".
2010-03-08 12:26:18 -08:00