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 /actionpack/test/fixtures | |
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 'actionpack/test/fixtures')
-rw-r--r-- | actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb b/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb new file mode 100644 index 0000000000..cd222a4a49 --- /dev/null +++ b/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb @@ -0,0 +1 @@ +phone
\ No newline at end of file |