Actually I've changed the whole thing to: def index @account = current_user.accounts.find_by_id(params[:account]) @transactions = @account.transactions; end
.. works fine On Saturday, 1 February 2014 14:45:25 UTC+9, Bizt wrote: > > Aaargh!!! I see it, I didn't type "account" correctly. I thought I was > using the method incorrectly. How did I not see that for so long?! > > @account = Users.accounts.find_by_id(params[:acco*o*unt]) > > > This now works - @account = current_user.accounts.find_by_id(params[: > *account*]) > > > > > > On Saturday, 1 February 2014 13:29:50 UTC+9, [email protected] wrote: >> >> Please, try Users instead of current_user, like : >> def index >> @account = Users.accounts.find_by_id(params[:accoount]) >> @transactions = @account.transactions.find_all_by_account(params[: >> accoount]); >> end >> >> >> On Sat, Feb 1, 2014 at 9:29 AM, Bizt <[email protected]> wrote: >> >>> Btw, I get the following error: >>> >>> undefined method `transactions' for nil:NilClass >>> To me this tells me that @account if not found, or is returning an empty >>> array. Am I using the wrong method, or parameters? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Talk" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/rubyonrails-talk/fd67df38-8b15-46ae-9f72-2c94068c12fb%40googlegroups.com >>> . >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> Thanks & Regard >> Vikram Jain >> ============= >> > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/588896a9-abaa-4b30-9d4b-5d389b89115e%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

