ruby -- 进阶学习(一)subdomain配置与实现
2024-10-18 12:21:53
今天和guanMac童鞋研究的subdomain配置终于有点头绪~~
之所以会遇到种种难题,个人总结了一下,第一本人太菜,第二英语不好
贴一下guanMac童鞋配置小结的链接:http://my.eoe.cn/guanmac/archive/6105.html
在rails4.0中实现二级域名是没有rails3.0中的复杂,只需要几步就可以了!
步骤如下:
- 在
config/routes
中添加constraints(Subdomain) do
get '/' => 'controllerName#actionName'
end - 在lib文档中添加一个 subdomain.rb
class Subdomain
def self.matches?(request) request.subdomain.present? && request.subdomain != "www"
end
end - 在
config/application.rb
中添加config.autoload_paths += %w(#(config.root)/lib )
在你的地址栏输入 www.lvh.me:3000 取代你的本地地址。
- 相关知识点链接
http://railsapps.github.io/tutorial-rails-subdomains.html
https://github.com/RailsApps/rails3-subdomains
http://railscasts.com/episodes/221-subdomains-in-rails-3?view=asciicast
最新文章
- iOS 隐藏状态栏
- BZOJ-2127-happiness(最小割)
- 四道简单DP
- Mac、Linux更换命令行svn diff为P4Merge、vimdiff
- Android中 int 和 String 互相转换的多种方法
- SlidesJS - 老牌的响应式 jQuery 幻灯片插件
- HNU 12812 Broken Audio Signal
- http header详解
- Angularjs 基于karma和jasmine的单元测试
- 在LINUX上创建GIT服务器
- splice() 方法通过删除现有元素和/或添加新元素来更改一个数组的内容。
- mysql 开发进阶篇系列 50 表的数据导入(load data infile,mysqlimport )
- 比MR至少快5倍的神器,竟然是它
- 大学jsp实验5request,response
- boost.lexical_cast 学习
- luogu P1776 宝物筛选_NOI导刊2010提高(02)
- 【转】《iOS7 by Tutorials》系列:iOS7的设计精髓(上)
- xencenter如何安装系统
- js网页上画图
- 2018.10.26 NOIP训练 数数树(换根dp)
热门文章
- [苏飞开发助手V1.0测试版]官方教程与升级报告
- 如何获得WPA握手包&;EWSA破解WPA密码教程[zz]
- 【高德地图API】如何设置Icon的imageSize?
- Scala 深入浅出实战经典 第62讲:Scala中上下文界定内幕中的隐式参数实战详解
- asp Gridview绑定形式获取行号
- mysql性能瓶颈分析、性能指标、指标搜集方法与性能分析调优工具
- JAVA常见错误处理方法 和 JVM内存结构
- Akismet API 密钥(key)免费获取方法
- 随机抽样一致性算法(RANSAC)示例及源代码
- React-Native入门指导之iOS篇 —— 一、准备工作