The route helper of engine output wrongly #3874

Closed
blackspace opened this Issue Dec 6, 2011 · 1 comment

Projects

None yet

1 participant

@blackspace

I have written a engine named shopping and the engine have one "product" resource.

In the shopping engine the config/routes.rb have the below content:

Shopping::Engine.routes.draw do
  match "shopping"=> "shopping/products#index"

  match "shopping/concerns/:action"=>"shopping/concerns"
  match "shopping/praisings/:action"=>"shopping/praisings"
  match "remove_image/:id/:image_uuid_id"=>"shopping/products#remove_image"
  post "shopping/orders/new"=>"shopping/orders#new"
  match "shopping/shop_information/:action"=>"shopping/shop_information"

  namespace :shopping do 
    resources :carts do
      resources :cart_details
    end
    resources :grids
    resources :orders
    resources :remarks
    resources :containers do
      resource :grids
    end
    resources :products do
      resources :options do 
    resource :option_values 
      end
      resources :articles
      resources :sub_products
      resources :comments
    end
    resources :virtues do 
      resources :virtue_possible_values 
    end 
  end
end

I mount the engine into my application as below:

mount Shopping::Engine=>"/space/:user_name"

In the shopping engine the shopping_engine_path helper can output the right path /space/bb(bb is a user for testing) and the shopping_engine.shopping_products_path output the right path /space/bb/products too.

In the main application the shopping_engine_path can work and output the right path /space/bb.However shopping_engine.shopping_products_path don't output the user name ,give me a wrong path /space/products,form_for [shopping_engine,@product] don't work too.

My rails version is 3.2.0 from github.

@blackspace

Now I see. Just add the :user_name option as argument to the route helper .

@blackspace blackspace closed this Dec 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment