Question: In my rails app, i have a create button as such

```
   def create
      @client = Client.find(params[:client_id])
      @inventory = @client.inventories.create(params[:inventory])
      redirect_to client_path(@client)
   end

```

which when an inventory is created (as a part of client, ex. client has\_many inventories, inventories belongs\_to clients), the inventory is added to the client in the database and it redirects to localhost:3000/client/(whatever the clients ID is) 

However, i'm having a problem with my program because although it does the correct redirect, the address in the address bar after i push create is localhost:3000/client/1/inventories/1... and I only want it to be localhost:3000/client/1/ . If I actually do try to access localhost:3000/client/1/inventories/1, it gives me an error because I don't have a show for inventories. 

How is it possibly doing the correct redirect, but the wrong URL is displayed in my browser? By the way, this is in my routes.rb, which does not seem like the problem to me. 

```
 resources :clients do
    resources :inventories
 end

```

Why is my app behaving like this? Any takers? :]

**EDIT** 

When I type rake routes I see this.
[![This](https://i.stack.imgur.com/f79pv.png)](https://i.stack.imgur.com/f79pv.png)
 The routes for create and destroy seem wrong. How do I change them?

Answer: 
A workaround to this problem is going to inventories controller and adding 

```
 def index
     @client = Client.find(params[:client_id])
     redirect_to client_path(@client)
 end

```

Looks like this was the best way to handle the back button hitting these errors, it seems like you cannot control the address displayed in the address bar. At least we don't know how.. :P
In this case, use:

```
redirect_to client_path(@client.id)

```