Assuming both instance vars have bene instantiated correctly
previously...
@user.errors.each { |k,v| @post.errors.add(k, v) } if
@user.errors.any?
should do it.
HTH,
Dan
On Feb 23, 10:48 pm, S Ahmed <[email protected]> wrote:
> I want to append to my models error collection from another models errors
> like:
>
> @user.errors each do |e|
> @post.errors << e
> end unless @user.valid?
>
> But it says:
>
> 'undefined method << for activemodel post .....
>
> What is errors then, a hash?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.