On Fri, Jan 31, 2014 at 9:47 PM, Bizt <[email protected]> wrote: > def index > @account = current_user.accounts.find_by_id(params[:account]) > @transactions = @account.transactions; > end > > .. works fine
Consider, though, that if for whatever reason an invalid id is passed in, @account will be nil and so @account.transactions will give you a NoMethod error. What do you want to happen at that point? -- Hassan Schroeder ------------------------ [email protected] http://about.me/hassanschroeder twitter: @hassan -- 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/CACmC4yDjWymqk7R6FkeVVCAa2qO6QAUEjP7ED4cB7BhTiXLfUg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

