提交 3ce9563d 编写于 作者: Ł Łukasz Strzałkowski

Variants inline syntax documentation [ci skip]

  * Extend method documentation
  * Mention it in actionpack/CHANGELOG
  * Update release notes
上级 6645a209
......@@ -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.
......
......@@ -209,6 +209,15 @@ def clear_respond_to
# 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)
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册