Commit Graph

12 Commits

Author SHA1 Message Date
Xavier Noria d4ab55e901 Delete orphan requires in AS::Dependencies 2021-08-19 00:14:06 +02:00
John Hawthorn d6ca73306c Force _routes to be redefined on re-inclusion
This fixes an regression where _routes were set incorrectly when the
inheritance chain went from one route namespace (isolated engine or main
app) to another and then back to the original. Because the url_helpers
module was being cached and was being re-included this was not setting
_routes.

This commit solves the issue by detecting that case and redefining
_routes in that case. We could have always performed the redefinition,
but it's a pretty uncommon case, so we might as well only do it when
necessary.
2021-02-16 11:55:22 -08:00
yuuji.yaginuma 9422433e1a Don't use deprecated `Module#parents` 2018-10-05 09:58:29 +09:00
schneems 235e734e1e Revert "Merge pull request #33970 from rails/eager-url-helpers"
Until #34050 can be resolved

This reverts commit 7f870a5ba2, reversing
changes made to 6556898884.
2018-10-03 16:15:47 -05:00
Aaron Patterson 338c3c45fa
Allow helpers to be deferred until the routes have been finalized
ActiveStorage::BaseController subclasses ActionController::Base.
ActionController::Base has an "inherited" hook set that includes the
routing helpers to any subclass of AC::Base.  Since
ActiveStorage::BaseController is a subclass of AC::Base, it will get
routing helpers included automatically.  Unfortunately, when the
framework is eagerly loaded, ActiveStorage::BaseController is loaded
*before* the applications routes are loaded which means it attempts to
include an "in flight" module so it gets an exception.

This commit allows a class that's interested in being extended with
routing helpers register itself such that when the routes are finalized,
it will get the helpers included.  If the routes are already finalized,
then the helpers get included immediately.
2018-09-25 14:58:39 -07:00
Kir Shatrov dfcc766163 Use frozen string literal in actionpack/ 2017-07-29 14:02:40 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
robertomiranda ce8efcf296 Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
2015-01-31 23:12:41 -05:00
@schneems and @sgrif 2bbcca004c Deprecate `*_path` methods in mailers
Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead.

Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR.

Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead.

The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`.

Paired @sgrif & @schneems
2014-07-30 12:01:45 -05:00
José Valim fd86a1b6b0 Rely on a public contract between railties instead of accessing railtie methods directly. 2011-11-23 19:06:45 +00:00
Piotr Sarnacki 4131a2d804 Move ActionController::Railties::RoutesHelpers and ActionMailer::Railties::RoutesHelper to AbstractController::Railties::RoutesHelpers 2010-09-03 22:59:11 +02:00