leonel
leonel

Reputation: 10214

Rails 3. How to setup a controller with custom params?

I create a controller to manage account balance BalanceController. It's supposed to use data from the Invoices and Expenses table. So I added one action to the BalanceController called account_balance. But I need to add a month and year param to generate a balance report.

This doesn't seem to work on routes.rb

get 'balance/account_balance/:month' => 'balance#account_balance/:month'

Upvotes: 0

Views: 99

Answers (1)

James
James

Reputation: 4807

get 'balance/account_balance/:month' => 'balance#account_balance'

The string is just a controller/action combo.

Going to /balance/account_balance/march would then route to the account_balance action of the balance controller and params[:month] would be set to 'march'.

Upvotes: 4

Related Questions