This is one cool feature for the latest version Rails, partly because I really enjoy seeing the Rails community build on front-end technologies. The addition is the request variant.

class CoursesController < ApplicationController

  before_action :check_device

  def index
    @courses = Course.all
    respond_to do |format|
      format.js           { render @courses.full }   { render @courses.annotated }
      format.html.tablet  { render @courses.semi_annotated } 

  def check_device
    request.variant = :tablet if request.user_agent =~ /iPad/
    request.variant = :phone if request.user_agent =~ /iPhone/

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.