mirror of https://github.com/rails/rails
Variants inline syntax documentation [ci skip]
* Extend method documentation * Mention it in actionpack/CHANGELOG * Update release notes
This commit is contained in:
parent
6645a2099a
commit
3ce9563d42
|
@ -45,6 +45,14 @@
|
||||||
app/views/projects/show.html+tablet.erb
|
app/views/projects/show.html+tablet.erb
|
||||||
app/views/projects/show.html+phone.erb
|
app/views/projects/show.html+phone.erb
|
||||||
|
|
||||||
|
You can also simplify the variants definition using the inline syntax:
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js { render "trash" }
|
||||||
|
format.html.phone { redirect_to progress_path }
|
||||||
|
format.html.none { render "trash" }
|
||||||
|
end
|
||||||
|
|
||||||
*Łukasz Strzałkowski*
|
*Łukasz Strzałkowski*
|
||||||
|
|
||||||
* Fix header `Content-Type: #<Mime::NullType:...>` in localized template.
|
* Fix header `Content-Type: #<Mime::NullType:...>` in localized template.
|
||||||
|
|
|
@ -209,6 +209,15 @@ module ActionController #:nodoc:
|
||||||
# app/views/projects/show.html+tablet.erb
|
# app/views/projects/show.html+tablet.erb
|
||||||
# app/views/projects/show.html+phone.erb
|
# app/views/projects/show.html+phone.erb
|
||||||
#
|
#
|
||||||
|
# When you're not sharing any code within the format, you can simplify defining variants
|
||||||
|
# using the inline syntax:
|
||||||
|
#
|
||||||
|
# respond_to do |format|
|
||||||
|
# format.js { render "trash" }
|
||||||
|
# format.html.phone { redirect_to progress_path }
|
||||||
|
# format.html.none { render "trash" }
|
||||||
|
# end
|
||||||
|
#
|
||||||
# Be sure to check the documentation of +respond_with+ and
|
# Be sure to check the documentation of +respond_with+ and
|
||||||
# <tt>ActionController::MimeResponds.respond_to</tt> for more examples.
|
# <tt>ActionController::MimeResponds.respond_to</tt> for more examples.
|
||||||
def respond_to(*mimes, &block)
|
def respond_to(*mimes, &block)
|
||||||
|
|
|
@ -62,6 +62,16 @@ app/views/projects/show.html+tablet.erb
|
||||||
app/views/projects/show.html+phone.erb
|
app/views/projects/show.html+phone.erb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also simplify the variants definition using the inline syntax:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
respond_to do |format|
|
||||||
|
format.js { render "trash" }
|
||||||
|
format.html.phone { redirect_to progress_path }
|
||||||
|
format.html.none { render "trash" }
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
### Spring
|
### Spring
|
||||||
|
|
||||||
New Rails 4.1 applications will ship with "springified" binstubs. This means
|
New Rails 4.1 applications will ship with "springified" binstubs. This means
|
||||||
|
|
Loading…
Reference in New Issue