1
我现在要开发的手机网站既支持常见的html格式页面和wml格式页面(因为现在手机上的常用网络浏览器可以查看html页面和一些旧手机只支持WML)如何休息我的应用程序以支持手机
第一步:
寄存器内容类型WML页面 配置/初始化/ mime_types.rb
哑剧:: Type.register_alias为 “text/vnd.wap.wml”:WML
秒: 为v中的动作创建两个格式页IEW:
class WelcomeController < ApplicationController
def index
@latest_on_sale_auctions = Auction.latest(15)
respond_to do |format|
format.html
format.wml
end
end
end
它的工作原理以及我访问: http://localhost:3000/welcome 不过的了:路由错误 无路线 “/welcome.wml” 匹配与{:方法=>:得到} 我访问:http://localhost:3000/welcome.wml
和它的作品以及我访问:http://localhost:3000/welcome?format=wml
my config/routes.rb like this:
ActionController::Routing::Routes.draw do |map|
map.root :controller => "welcome"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
我的Rails的版本是2.3.5,请帮帮我,我希望有一个宁静的应用程序,都支持HTML和WML。