| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
This fixes the following warning:
```
/tmp/d20170727-7039-kmdtb1/app/app/models/user.rb:5: warning: method redefined; discarding old model_name
rails/activemodel/lib/active_model/naming.rb:222: warning: previous definition of model_name was here
```
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
|
| |
Use a separate method called `resolve` for the custom polymorphic
mapping to clarify the API.
|
|
|
|
|
|
| |
Using `undef_method` means that when a route is removed any other
implementations of that method in the ancestor chain are inaccessible
so instead use `remove_method` which restores access to the ancestor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g:
resource :basket
direct(class: "Basket") { [:basket] }
This will then generate the following:
>> link_to "Basket", @basket
=> <a href="/basket">Basket</a>
More importantly it will generate the correct url when used with `form_for`.
Fixes #1769.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Allow the definition of custom url helpers that will be available
automatically wherever standard url helpers are available. The
current solution is to create helper methods in ApplicationHelper
or some other helper module and this isn't a great solution since
the url helper module can be called directly or included in another
class which doesn't include the normal helper modules.
Reference #22512.
|
| |
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
| |
- The `boot_rails` method from abstract_unit.rb is empty after 2abcdfd978fdcd491576a237e8c6b.
- So let's remove it and its usage.
|
|
|
|
|
|
|
|
| |
The /rails/info routes were inaccessible in apps with a catch-all
globbing route, as they were being appended after the globbing route and
would never be matched.
See also ccc3ddb7762bae0df7e2f8d643b19b6a4769d5be.
|
|
|
|
| |
As requested by David in 23233.
|
|
|
|
|
| |
Here `app` needed to be `get` because we're getting a route. This fixes
the typo so the test passes.
|
|
|
|
|
|
| |
Vaguely related to #21605 where I proposed to remove index route since it was redirecting to the 'routes' action,
but this was kept so I thought it made sense to add some tests regarding this.
|
|
|
|
| |
See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492
|
|
|
|
|
|
|
|
| |
Showing welcome page in production can expose information, which should
not be visible on production if people don't override the default root
route.
This reverts commit b0caea29c2da9f4c8bb958019813482da297067d.
|
|\
| |
| | |
Match Dev/Prod parity for Index Page
|
| |
| |
| |
| |
| |
| |
| | |
With Rails 4 the default index page was moved from a static file `index.html` inside the `public/` folder to an internal controller/view inside of the railties gem. This was to allow use of erb in the default index page and to remove the requirement that new apps must delete a static file to make their index pages work. While this was a good change, the functionality was unexpected to developers who wish to get their apps running in production ASAP. They will create a new app `rails new my app`, start a server to verify it works, then immediately deploy the app to verify that it can start working in production. Unfortunately locally they see a page when they visit `localhost:3000` when they visit their production app they get an error page.
We initially anticipated this problem in the original pull request, but did not properly anticipate the severity or quantity of people who would like this functionality. Having a default index page serves as an excellent litmus test for a passed deploy on default apps, and it is very unexpected to have a page work locally, but not on production.
This change makes the default index page available in production if the developer has not over-written it by defining their own `root` path inside of routes.
|
|/
|
|
|
|
|
|
| |
Fix an issue where Journey was failing to clear the named routes hash when the
routes were reloaded and since it doesn't overwrite existing routes then if a
route changed but wasn't renamed it kept the old definition. This was being
masked by the optimised url helpers so it only became apparent when passing an
options hash to the url helper.
|
|
|
|
|
| |
more agnostic Rails.application syntax. This means tests will be more
portable, and won't rely on the existence of a particular subclass.
|
| |
|
|
|
|
|
| |
Remove all the old url helper methods when clear! is called on the
route set because it's possible that some routes have been removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an alternative implementation to #7771 thanks to the advice of @spastorino
Rails is a dynamic framework that serves a static index.html by default. One of my first questions ever on IRC was solved by simply deleting my public/index.html file. This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion.
This PR moves the static index page to an internal controller/route/view similar to `rails/info`. When someone starts a rails server, if no root is defined, this route will take over and the "dynamic" index page from rails/welcome_controller will be rendered. These routes are only added in development. If a developer defines a root in their routes, it automatically takes precedence over this route and will be rendered, with no deleting of files required.
In addition to removing this source of confusion for new devs, we can now use Rails view helpers to build and render this page. While not the primary intent, the added value of "dogfooding" should not be under-estimated.
The prior PR #7771 had push-back since it introduced developer facing files. This PR solves all of the same problems, but does not have any new developer facing files (it actually removes one).
cc/ @wsouto, @dickeyxxx, @tyre, @ryanb, @josevalim, @maxim, @subdigital, @steveklabnik
ATP Railties and Actionpack.
|
|
|
|
| |
This reverts commit c59734f756b79c39486c45273d2cc5d42cd0c864.
|
|
|
|
|
|
|
|
|
|
| |
This commit inverts the precedence in ActionDispatch::Static so that
dynamic content will be served before static content. This is so that
precompiled assets do not inadvertently get included when running in
development mode - it should have no effect in production where static
files are usually handled by the web server.
Closes #6421
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 6acebb38bc0637bc05c19d87f8767f16ce79189b.
Usage of this feature did not reveal any improvement in existing apps.
Conflicts:
actionpack/lib/action_dispatch/routing/mapper.rb
guides/source/routing.textile
railties/lib/rails/engine.rb
railties/lib/rails/paths.rb
railties/test/paths_test.rb
|
|
|
|
| |
This includes new tests for /rails/info/routes
|
|
|
|
| |
Remove deprecation warning of method redefined.
|
| |
|
|
|
|
|
|
|
|
|
| |
This feature enables the ability to load an
external routes file from the router via:
draw :filename
External routes files go in +config/routes+. This
feature works in both engines and applications.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the current router DSL, using the +match+ DSL
method will match all verbs for the path to the
specified endpoint.
In the vast majority of cases, people are
currently using +match+ when they actually mean
+get+. This introduces security implications.
This commit disallows calling +match+ without
an HTTP verb constraint by default. To explicitly
match all verbs, this commit also adds a
:via => :all option to +match+.
Closes #5964
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Allows specifying blocks to the routeset that will get appended after the RouteSet is drawn.
|
|
|
|
| |
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
|
| |
|
| |
|
|
|
|
| |
ensuring all configuration options were applied.
|
| |
|
|
|
|
|
|
| |
available standards support. This ensures that IE doesn't go into quirks mode because it has been blacklisted by too many users pressing the incompatible button. It also tells IE to use the ChromeFrame renderer, if the user has installed the plugin.
This guarantees that the best available standards support will be used on the client.
|