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

Variants inline syntax documentation [ci skip]

* Extend method documentation
  * Mention it in actionpack/CHANGELOG
  * Update release notes
This commit is contained in:
Łukasz Strzałkowski 2013-12-12 11:02:06 +01:00
parent 6645a2099a
commit 3ce9563d42
3 changed files with 27 additions and 0 deletions

View file

@ -45,6 +45,14 @@
app/views/projects/show.html+tablet.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*
* Fix header `Content-Type: #<Mime::NullType:...>` in localized template.

View file

@ -209,6 +209,15 @@ module ActionController #:nodoc:
# app/views/projects/show.html+tablet.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
# <tt>ActionController::MimeResponds.respond_to</tt> for more examples.
def respond_to(*mimes, &block)

View file

@ -62,6 +62,16 @@ app/views/projects/show.html+tablet.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
New Rails 4.1 applications will ship with "springified" binstubs. This means