I'm using rails3 and I want to have a route prefix like below:
I have the following in my routes:
require 'resque/server'
Woofound::Application.routes.draw do
scope "/:my_param" do
resource :users
end
end
And then I have the following in my application controller:
class ApplicationController < ActionController::Base
before_filter :check_param
private
def check_param
unless Myobject.find_by_param(param[:my_param])
raise "You must add this param"
end
end
end
And then in my routes I want to have be able to access the user_path(@user) without having to do
user_path(:param_for_route_name_spacing, @user)
If you need more clarity let me know.
And in short I want to have a parameterized prefix for my route with the parameter automatically being passed back into the parameterized namespace without having to add it as the first argument to am object path.
try
class ApplicationController < ActionController::Base
def user_path(user)
super(:param_for_route_name_spacing, user)
end
end