Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # route.rb has:
- # resources :user do
- # resources :accounts do
- # end
- class AccountsController < ApplicationController
- before_filter :retrieve_user
- respond_to :html, :json
- # GET /accounts
- # GET /accounts.json
- def index
- @accounts = Account.all
- @accounts = @user.accounts if @user
- respond_with @accounts
- end
- protected
- def retrieve_user
- @user = User.find params[:user_id]
- end
- end
Add Comment
Please, Sign In to add comment