How to pass params to a block in Rails routes?
问题 I am using Rails 3. And I'm wondering how to pass params to some blocks in routes.rb . What I'm trying to do is to make a catch all route, that check from slugs database the model name of it by the id. After getting the model name i pluralize it to get the controller name. match '/:id', :controller => proc { Slug.find_by_iid(params[:id]).model.pluralize }, :action => :show The table slugs model iid ----- ----- post 4d2c7de0c5abe7f8a9000007 item 4d2c7de0c5abe7f809000004 When I try to access