| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
We no longer depend on `rendered_format` side effects, so we can remove
this method now. đ
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces "rendered template" and "rendered collection"
objects. The template renderers can now return a more complex object
than just strings. This allows the framework to get more information
about the templates that were rendered. In this commit we use the
rendered template object to set the "rendered_format" on the lookup
context in the controller rather than all the way in the template renderer.
That means we don't need to check the "rendered_format" every time we
render a template, we just do it once after all templates have been
rendered.
|
|
|
|
|
|
|
|
|
|
|
| |
This commit keeps a stack of lookup contexts on the ActionView::Base
instance. If a format is passed to render, we instantiate a new lookup
context and push it on the stack, that way any child calls to "render"
will use the same format information as the parent. This also isolates
"sibling" calls to render (multiple calls to render in the same
template).
Fixes #35222 #34138
|
|
|
|
|
| |
This commit splits the digest cache from the "details identity" cache.
Now both caches can be managed independently.
|
| |
|
| |
|
|
|
|
|
| |
Now we can throw away the subclass and the generated methods will get
GC'd too
|
|
|
|
|
|
|
| |
This patch removes the instance writer of view_context_class.
Subclasses may override it, but it doesn't need to be written. This
also eliminates the need to cache the return value of the class level
`view_context_class` method.
|
|
|
| |
[ci skip]
|
|
|
|
| |
[ci skip]
|
|
|
|
| |
This basically reverts c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently `:api:` tag has leaked on the doc directly since RDoc doesn't
support `:api:` tag directive.
http://api.rubyonrails.org/v5.1/classes/AbstractController/Rendering.html
So `:api: private` doesn't work as expected. We are using `:nodoc:` for
the purpose.
Related #13989.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
In 4.2, since AC::Params inherited `Hash`, processing in the case of
`Hash` was done. But in 5.x, since AC::Params does not inherit `Hash`,
need to add care for AC::Params.
Related to 00285e7cf75c96553719072a27c27e4ab7d25b40
|
| |
|
| |
|
| |
|
|
|
|
|
| |
`render` is the only possible source for the `plain` option. Pulling
the conditional up to the `render` method removes far away conditionals
|
|
|
|
|
|
| |
We don't need to pass the full hash just to pull one value out. It's
better to just pass the value that the method needs to know about so
that we can abstract it away from "options"
|
|
|
|
| |
Various grammar corrections and wrap to 80 characters.
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit 585e75696b31395aee895e5366e331c07c3f5ee1.
|
|
|
|
|
|
|
| |
This reverts commit 07635a74b5ee08dcba3f6617def6230d8f114fe5, reversing
changes made to 1b5f61a025b6ce1ee52b7148e3ed2a9acbde28b9.
Reason: it's not ready :bomb:, see https://github.com/rails/rails/pull/16888#issuecomment-56400816
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`render :body` should just not set the `Content-Type` header. By
removing the header, it breaks the compatibility with other parts.
After this commit, `render :body` will returns `text/html` content type,
sets by default from `ActionDispatch::Response`, and it will preserve
the overridden content type if you override it.
Fixes #14197, #14238
This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
|
|
|
|
|
| |
Setting this attribute to `true` will remove the content type header
from the request. This is use in `render :body` feature.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an option for sending a raw content back to browser. Note that
this rendering option will unset the default content type and does not
include "Content-Type" header back in the response.
You should only use this option if you are expecting the "Content-Type"
header to not be set. More information on "Content-Type" header can be
found on RFC 2616, section 7.2.1.
Please see #12374 for more detail.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow setting `request.variant` as an array - an order in which they will be
rendered.
For example:
request.variant = [:tablet, :phone]
respond_to do |format|
format.html.none
format.html.phone # this gets rendered
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By default, variants in the templates will be picked up if a variant is set
and there's a match. The format will be:
app/views/projects/show.html.erb
app/views/projects/show.html+tablet.erb
app/views/projects/show.html+phone.erb
If request.variant = :tablet is set, we'll automatically be rendering the
html+tablet template.
In the controller, we can also tailer to the variants with this syntax:
class ProjectsController < ActionController::Base
def show
respond_to do |format|
format.html do |html|
@stars = @project.stars
html.tablet { @notifications = @project.notifications }
html.phone { @chat_heads = @project.chat_heads }
end
format.js
format.atom
end
end
end
The variant itself is nil by default, but can be set in before filters, like
so:
class ApplicationController < ActionController::Base
before_action do
if request.user_agent =~ /iPad/
request.variant = :tablet
end
end
end
This is modeled loosely on custom mime types, but it's specifically not
intended to be used together. If you're going to make a custom mime type,
you don't need a variant. Variants are for variations on a single mime
types.
|
|
|
|
| |
Closes #12831
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The methods:
* #render_to_body
* #render_to_string
* #_normalize_render
Haven't had anything specyfic to ActionView. This was common code which should belong to AbstractController
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This reverts commit f4d602aff6cec80304b131ecfcc2676d0304f0cc.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
It wasn't adding anything, just invoking super
|
| |
|
| |
|