2010-11-21 35 views
0

benim rails2.x uygulamasında bu yolu vardıraylar 3. + yönlendirme problemi

'web_page' adlı bir kontrolöre benim köküne sonra 'indeks'

denilen bir eyleme her ad yönettiği

map.with_options(:controller => "web_page") do |site| 
    site.connect "*url", :action => "index" 
end 

Ör: bir ben tip http://localhost:3000/products o http://localhost:3000/web_pages/index

giderse bir ben tip http://localhost:3000/services hala http://localhost:3000/web_pages/index

giderse

Ama nasıl raylar 3. yolları yapabilirsiniz

önceden pls

sayesinde yardımcı

şerefe

sameera

cevap

0

Sen kullanabilirsiniz:

match '/:all' => 'web_page#index', :constraints => { :all => /.+/ } 

istemek http://example.com/this/is/a/test?option=true olur:

class WebPageController < ApplicationController 
    def index 
    @all = params[:all] # "this/is/a/test" 
    @path = request.path # "/this/is/a/test" 
    @query = request.query_parameters # {"option"=>"true"} 
    end 
end 
+0

Merhaba Sinetris, çok teşekkürler – sameera207