You can setup a route that matches anything, then split the parameter inside your controller:
resources :modelname do
match 'compare/*path' => 'controller#compare_action'
end
# controller:
def compare_action
@modelname = Modelname.find(params[:path].split(','))
end