force_mobile_format #16

Merged
merged 1 commit into from Aug 8, 2011

Conversation

Projects
None yet
3 participants
Contributor

gareth commented Jan 19, 2011

I noticed that when testing my mobile interface, my AJAX requests were failing.

It turned out that force_mobile_format was forcing those requests to be interpreted as :mobile, and that meant my action, which looked like below, couldn't work properly

  format.any(:html, :mobile)
  format.js {
    dataset = @datasets.find { |d| dataset_cache_key(d) == params[:key] }
    raise unless dataset
    render :partial => "datasets/dataset_output", :locals => {:dataset => dataset}
  }

I guess the intention of force_mobile_format is to work identically to set_mobile_format, except that it doesn't care whether the UA is a mobile device or not. So, my patch represents that :)

Let me know if you agree :)

brendanlim added a commit that referenced this pull request Aug 8, 2011

@brendanlim brendanlim merged commit cfd29fb into brendanlim:master Aug 8, 2011

dcu commented on 2a4be46 Jan 4, 2012

why is this? it does not allow to force when using jquery-mobile

SentulAsia referenced this pull request in brainstormtech/mobile-fu Jun 5, 2012

Merge pull request #16 from bratsche/master
Set request.format to :mobile or :tablet, but don't assume it's :html otherwise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment