diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-12-10 00:36:18 +0100 |
---|---|---|
committer | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-12-10 11:55:43 +0100 |
commit | edacdbfaf93ac1a81ec8654da4df03b80488e85c (patch) | |
tree | 8e357214a821e2a5a322fbd27f4f340218d4f738 /railties/lib/rails/generators/app_base.rb | |
parent | fbb6be50a55fef24cdef97c522d1acc9787cbf2a (diff) | |
download | rails-edacdbfaf93ac1a81ec8654da4df03b80488e85c.tar.gz rails-edacdbfaf93ac1a81ec8654da4df03b80488e85c.tar.bz2 rails-edacdbfaf93ac1a81ec8654da4df03b80488e85c.zip |
Inline variants syntax
In most cases, when setting variant specific code, you're not sharing any code
within format.
Inline syntax can vastly simplify defining variants in those situations:
respond_to do |format|
format.js { render "trash" }
format.html do |variant|
variant.phone { redirect_to progress_path }
variant.none { render "trash" }
end
end
Becomes:
respond_to do |format|
format.js { render "trash" }
format.html.phone { redirect_to progress_path }
format.html.none { render "trash" }
end
Diffstat (limited to 'railties/lib/rails/generators/app_base.rb')
0 files changed, 0 insertions, 0 deletions