On Fri, Jan 31, 2014 at 9:47 PM, Bizt <martyn.biz@gmail.com> 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 ------------------------ hassan.schroeder@gmail.com
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 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/CACmC4yDjWymqk7R6FkeVVCAa2qO6QAUEjP7ED4cB7BhTiXLfUg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment