plataformatec/responders — pull request #101 by DamirSvrtan (2014-11-07 11:25:17+00:00)
Title: Use singular and plural table name to generate properly namespaced controllers

The controller that was generated when creating a namespaced resource was:

```ruby
class Client::OrdersController < ApplicationController
before_action :set_order, only: [:show, :edit, :update, :destroy]

def index
@client_orders = Client::Order.all
respond_with(@client_orders)
end

def show
respond_with(@order)
end

def new
@order = Client::Order.new
respond_with(@order)
end

def edit
end

def create
@order = Client::Order.new(order_params)
@client_order.save
respond_with(@order)
end

def update
@client_order.update(order_params)
respond_with(@order)
end

def destroy
@client_order.destroy
respond_with(@order)
end

private
def set_order
@order = Client::Order.find(params[:id])
end

def order_params
params.require(:order).permit(:title)
end
end
```
This change will create a proper controller such as this one:

```ruby
class Client::OrdersController < ApplicationController
before_action :set_client_order, only: [:show, :edit, :update, :destroy]

def index
@client_orders = Client::Order.all
respond_with(@client_orders)
end

def show
respond_with(@client_order)
end

def new
@client_order = Client::Order.new
respond_with(@client_order)
end

def edit
end

def create
@client_order = Client::Order.new(order_params)
@client_order.save
respond_with(@client_order)
end

def update
@client_order.update(order_params)
respond_with(@client_order)
end

def destroy
@client_order.destroy
respond_with(@client_order)
end

private
def set_client_order
@client_order = Client::Order.find(params[:id])
end

def client_order_params
params.require(:client_order).permit(:title)
end
end
```