Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Chris Beck's Profile

GitHub User: ccmcbeck

Comments by Chris Beck


Depends on what your are trying to do in your controller tests, but here is what I did

  before do

If, like me, you also use Ryan's awesome nested_form gem, then you will be very interested in Issue #145 where the compatibilities with Turbolinks are getting resolved


Erich, that looks pretty nice. Perhaps your pattern is a good way to DRY up code between two PushState frameworks (Turbolinks on Desktop / jQuery Mobile on Mobile)


While I was thinking about it, I migrated to Turbolinks. Since I use bootstrap, I needed the gem to deal with the fact that bootstrap binds events to the body tag (this will be fixed in future releases to use the html tag).

Also, I use Turbolinks for my forms (like search) that use GET

  $('form[method=get]:not([data-remote])').on 'submit', (event) ->
    Turbolinks.visit @.action + '?' + $(@).serialize()

It was easy (1-2 days) for me to migrate my Rails 3.2 desktop app to use PJAX via the rack-pjax gem. I picked that gem because you specify the container. I chose to just PJAX the content between my header and footer tags.

However, I have a feeling that most of the performance win comes from not reprocessing the head tag so I would expect that just fragmenting the entire body is good enuff. When I get the time, I'll migrate from PJAX to Turbolinks.

Has anyone had any experience integrating either PJAX or Turbolinks with jQuery Mobile. JQM does has it's own pushState manager and converts all links into AJAX requests. It also does DOM caching of those pages so there are several issues to consider.


They now work out of the box with bootstrap and simple-form if you use the simple-form plugin which supports bootstrap wrappers

gem 'simple_form', '2.0.4'
gem 'client_side_validations', '3.2.1'
gem 'client_side_validations-simple_form', '2.0.1'

The gems must go in this order


Really a great technique. Rather than using a querystring param, I choose to use the URL extension. It just felt better than a querystring since Rails already responds to that to determine the correct MIME format:

def mobile_device?
  session.has_key?(:mobile) ? session[:mobile] : request.user_agent =~ /Mobile|webOS/
helper_method :mobile_device?

def prepare_for_mobile
  if request.format == 'text/html'
    case File.extname(URI.parse(request.fullpath).path)
    when '.html'
      session[:mobile] = false
    when '.mobile'
      session[:mobile] = true
    request.format = :mobile if mobile_device?