Ruby on Rails Friday, January 31, 2014

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[:accoount])


This now works - @account = current_user.accounts.find_by_id(params[:account])





On Saturday, 1 February 2014 13:29:50 UTC+9, jainvi...@gmail.com 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 <marty...@gmail.com> 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 rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.

1 comment:

Anonymous said...

Unique blog having such a valuable content !!!. Good Job ! I enjoyed enough reading your latest article to read it again and again.

Post a Comment