Friday, February 10, 2012

[Rails] [mobile website in RoR] redirect_to issue

Hi Guys,

I'm working to show a RoR form webpage on an iPhone

WHAT I DID

1. create a model controller and view called 'form'

2. create a view for a html format and for a mobile format

3. I have the view form in the new.html.erb and new.mobile.erb file

4. for the html format I don't have problem I can fill out the form
after the user push the 'submit' button appear the redirect page
'show.html.erb' and the user receive a notify mail

5. when I fill out the mobile view form from an iPhone the user receive
the mail but don'y appear the show.mobile.erb page for the redirect

ISSUE

How can figure out the issue of above point 5. ? follow my
form_controller.rb file

class FormsController < ApplicationController

def index
@form = Form.all
respond_to do |format|
format.html
format.mobile
end
end

def new
@form = Form.new
end

def create
@form = Form.new(params[:form])

respond_to do |format|

if @form.save

FromMailer.notifica_email(@form).deliver
format.html { redirect_to(@form, :notice => 'ok') }
format.mobile { render :mobile => @form, :status => :created,
:location => @form }

else
format.html { render :action => "new" }
format.mobile { render :mobile => @form.errors, :status =>
:unprocessable_entity }
end

end

end

def show
@form = Form.find(params[:id])

respond_to do |format|
format.html
format.mobile
end
end

end

thank you in advance

Cluer

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate