本月博客排行
-
第1名
龙儿筝 -
第2名
zysnba -
第3名
johnsmith9th - wy_19921005
- sgqt
年度博客排行
-
第1名
宏天软件 -
第2名
青否云后端云 -
第3名
龙儿筝 - gashero
- wallimn
- vipbooks
- benladeng5225
- wy_19921005
- fantaxy025025
- javashop
- qepwqnp
- e_e
- 解宜然
- zysnba
- ssydxa219
- sam123456gz
- ranbuijj
- arpenker
- tanling8334
- kaizi1992
- xpenxpen
- gaojingsong
- wiseboyloves
- xiangjie88
- ganxueyun
- sichunli_030
- xyuma
- wangchen.ily
- jh108020
- zxq_2017
- jbosscn
- lemonhandsome
- luxurioust
- Xeden
- lzyfn123
- forestqqqq
- zhanjia
- nychen2000
- ajinn
- wjianwei666
- johnsmith9th
- hanbaohong
- daizj
- 喧嚣求静
- silverend
- mwhgJava
- kingwell.leng
- lchb139128
- lich0079
- kristy_yy
最新文章列表
rails tips
rails3.2 没有匹配上的路由,统一跳转到一个地址:
get '*path', via: :all, to: 'home#app'
get '*path', via: :all, to: 'home#render_404'
ruby-china上使用的是match
match '*path', via: :all, to: 'home#app'
match '*path', via: :a ...
goliath 1.0.4 解决自定义路由
goliath从1.0版本以后,因为routes存在bug,开发者还没有找到合适的解决方法,暂时把routes这部分功能给禁掉了,那么我们可以通过一下的方法来自定义路由:
require 'rubygems'
require 'goliath'
require 'em-http'
class HttpLog < Goliath::API
use ::Rack::Rel ...
Rails route constraints api 介绍
Rails 为route的路由约束提供了constraints 方法,具体的使用如下:
限制IP地址constraints(:ip => /192.168.\d+.\d+/) do
resources :posts
end
可以提供一个ip或者一个ip地址的范围进行限制,一旦检测到用户的ip地址符合限制范围,则会告知不存在此route。
匹配动态请求这个例子是控制rou ...
Camel Routes
Routes
Camel supports the definition of routing rules using a Java DSL (domain specific language) which avoids the need for cumbersome XML using a RouteBuilder.
For example a simple route can be cr ...
用RSPEC测试路由
基本
require "spec_helper"
describe "routes for Widgets" do
it "routes /widgets to the widgets controller" do
{ :get => "/widgets" }.
should ...
5.2 rails routes
1. the purpose of rails routes:
a. recognize url, and dispatch to correct controller and actions
b. generate named routes, i.e. paths and urls, so the you needn't hardcode them in views
2. the ...
5.2 integration test using rspec.
in this chapter,we will see a very simple integration test to test routes in rails.
controller test is only able to test routes inside the controller, so if you want to test global routes, like hom ...
Rails 2.3.12下遇到的named route的诡异问题
周五的时候把网站升级到Rails 2.3.12,本来在本地测试都没有问题的,但是在服务器上遇到一个非常诡异的问题,足足用了一天一夜的时间。
本地: Mac OS X 10.7,Ruby 1.8.7,Rails 2.3.12
服务器:Ubuntu 8.04,Ruby Enterprise Edition 1.8.7,Rails 2.3.12
在服务器上,但凡是在 routes.rb 里面定义的 ...