Skip to content
  • Łukasz Strzałkowski's avatar
    a288cc1e
    Add any/all support for variants · a288cc1e
    Łukasz Strzałkowski authored
    Like `format.any`, you can do the same with variants.
    
    It works for both inline:
    
        respond_to do |format|
          format.html.any   { render text: "any"   }
          format.html.phone { render text: "phone" }
        end
    
    and block syntax:
    
        respond_to do |format|
          format.html do |variant|
            variant.any(:tablet, :phablet){ render text: "any" }
            variant.phone { render text: "phone" }
          end
        end
    a288cc1e
    Add any/all support for variants
    Łukasz Strzałkowski authored
    Like `format.any`, you can do the same with variants.
    
    It works for both inline:
    
        respond_to do |format|
          format.html.any   { render text: "any"   }
          format.html.phone { render text: "phone" }
        end
    
    and block syntax:
    
        respond_to do |format|
          format.html do |variant|
            variant.any(:tablet, :phablet){ render text: "any" }
            variant.phone { render text: "phone" }
          end
        end
Loading