Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6127555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:31:26+00:00 2026-05-23T16:31:26+00:00

What step am I missing? The view being returned to my iPhone is coming

  • 0

What step am I missing? The view being returned to my iPhone is coming from application.html.erb and index.html.erb

Step 1: In config/initializers/mime_types.rb uncomment the declaration line for the iPhone:

Mime::Type.register_alias "text/html", :iphone

Step 2: Make a copy of app/views/layouts/application.html.erb calling it application.iphone.erb (I like to change the title to something specific to your iPhone so you can see immediately that the correct layout is being used)

<title>My iPhone Tasks</title>

Step 3: Make copies of the necessary view files in your controllers, calling them things like index.iphone.erb

Step 4: Decide whether to stick with the Rails 2 model of respond_to blocks that specifically call out a format of iphone or switch to the more DRY approach that uses the respond_with call. That’s what I’ve done, er tried 😉

Step 4a: Add to your controller the respond_to block:

class TasksController < ApplicationController
respond_to :html, :iphone

Step 4b: DRY up your methods, such as:

def index
  @tasks = Task.all
  respond_with (@tasks)
end

Step 5: Restart your server and hit the app from your iPhone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:31:26+00:00Added an answer on May 23, 2026 at 4:31 pm

    You have to write a responder for your mobile mime type for respond_with to properly work.

    Define the responder in application_controller.rb:

      def self.responder
        MobileResponder
      end
    
    class MobileResponder < ActionController::Responder
    
      def to_format
        super
      rescue ActionView::MissingTemplate => e
        if request.format == "iphone"
          navigation_behavior(e)
        else
          raise unless resourceful?
          api_behavior(e)
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a step in my application where a user repeatedly hears three spoken
I must be missing a step here. <toolkit:BusyIndicator HorizontalAlignment=Center VerticalAlignment=Center Name=busyIndicator IsBusy={Binding BusyIndicator}> <Grid
Anyone know how you can call a functional equivalent to Html.EditorFor() from the Controller?
I'm looking for a step-by-step explanation on how to go from the normal folder
if step.include? apples or banana or cheese say yay end
I have a three-step process that is entirely reliant upon JavaScript and Ajax to
In a scripting step in a scheduled task in SQL Server Agent 2005, I
Please note: In each step I describe below I'm logged in as the same
Is it possible to step though Classic ASP VB code without Visual interdev or
I have completed every step in XMonad's tutorial for Mac. However, I cannot start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.