Hi,
I have used validates_xxxx_of method in the model. Here is an extract
of the returned object:
0: &id001 !ruby/object:ProductOption
attributes:
time_last_modified: *id002
name: nnn
color:
errors: !ruby/object:ActiveRecord::Errors
base: *id003
errors:
name:
- invalid name
- name missing
color:
- invalid color
- color missing
new_record: true
1: &id003 .............
As you can see, there is an index for the object, because I am saving
multiple records in the same time.
I know that I can access to the errors by
error_messages_for/each_full_messages method, however, I am not sure how
to use it in my case.
So, is there a way to access to the errors "invalid name", "name
missing", etc. in the model and construct a more meaningful object to
return to the controller?
Thanks!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---