2011-08-10 134 views
2

我開發在西班牙語中的應用,所以我不得不修改多元化的規則對一些表,在表中的城市,我有這樣的:沒有路由匹配「/ ciudades」

ActiveSupport::Inflector.inflections do |inflect| 
    inflect.plural /ciudad$/i, '\1ciudades' 
    inflect.singular /ciudades/i, '\1ciudad' 
    end 

我有測試檢查設置多元化:

"ciudad".pluralization 
ciudades 

運行支架

rails generate scaffold ciudad nombre:string departamento_id:integer 

和上次運行遷移

rake db:migrate

但到了打開URL http://localhost:3000/ciudades服務器視圖

Routing Error 

No route matches "/ciudades" 

耙路線

  ciudades GET /ciudades(.:format)    {:controller=>"ciudades", :action=>"index"} 
        POST /ciudades(.:format)    {:controller=>"ciudades", :action=>"create"} 
     new_ciudad GET /ciudades/new(.:format)   {:controller=>"ciudades", :action=>"new"} 
     edit_ciudad GET /ciudades/:id/edit(.:format)  {:controller=>"ciudades", :action=>"edit"} 
      ciudad GET /ciudades/:id(.:format)   {:controller=>"ciudades", :action=>"show"} 
        PUT /ciudades/:id(.:format)   {:controller=>"ciudades", :action=>"update"} 
        DELETE /ciudades/:id(.:format)   {:controller=>"ciudades", :action=>"destroy"} 
    departamentos GET /departamentos(.:format)   {:controller=>"departamentos", :action=>"index"} 
        POST /departamentos(.:format)   {:controller=>"departamentos", :action=>"create"} 
new_departamento GET /departamentos/new(.:format)  {:controller=>"departamentos", :action=>"new"} 
edit_departamento GET /departamentos/:id/edit(.:format) {:controller=>"departamentos", :action=>"edit"} 
    departamento GET /departamentos/:id(.:format)  {:controller=>"departamentos", :action=>"show"} 
        PUT /departamentos/:id(.:format)  {:controller=>"departamentos", :action=>"update"} 
        DELETE /departamentos/:id(.:format)  {:controller=>"departamentos", :action=>"destroy"} 
    tipo_terceros GET /tipo_terceros(.:format)   {:controller=>"tipo_terceros", :action=>"index"} 
        POST /tipo_terceros(.:format)   {:controller=>"tipo_terceros", :action=>"create"} 
new_tipo_tercero GET /tipo_terceros/new(.:format)  {:controller=>"tipo_terceros", :action=>"new"} 
edit_tipo_tercero GET /tipo_terceros/:id/edit(.:format) {:controller=>"tipo_terceros", :action=>"edit"} 
    tipo_tercero GET /tipo_terceros/:id(.:format)  {:controller=>"tipo_terceros", :action=>"show"} 
        PUT /tipo_terceros/:id(.:format)  {:controller=>"tipo_terceros", :action=>"update"} 
        DELETE /tipo_terceros/:id(.:format)  {:controller=>"tipo_terceros", :action=>"destroy"} 
+1

你檢查你的routes.db文件? –

+0

我的routes.rb文件是: 資源:ciudades 資源:departamentos 資源:tipo_terceros – andres

+0

請告訴我們'耙的輸出routes' –

回答

0

使用該在你的變形來代替:

ActiveSupport::Inflector.inflections do |inflect| 
inflect.irregular 'ciudad', 'ciudades' 
end