How to force the routing format being the request one

I am trying to test the mobile way … using mobile_fu and adding
the :mobile format
most of my test code is running adding :format => :mobile when
necessary, but I wonder how when a controller respond to the :mobile
format, the routing can use the request format

In this test case ( contact form) , when the request is coming from a
mobile, redirect_to new_contact_url is still using :html

thanks for feedback

has_mobile_fu
respond_to :html, :mobile, :tablet

def new
@contact = ContactForm.new()
end

def create
destination = Rails.configuration.contact_address
@contact = ContactForm.new(subject:
I18n.t(“mail_form.contact_form_subject”), destination: destination,
name: params[:contact_form][:name], email: params[:contact_form]
[:email], message: params[:contact_form][:message])
if @contact.save
flash[:notice] = t(:message_send)
@contact = ContactForm.new()
redirect_to new_contact_url
else
render :new
end
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs