mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
edacdbfaf9
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 |
||
---|---|---|
.. | ||
accept_format_test.rb | ||
respond_to_test.rb | ||
respond_with_test.rb |