Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Ruby course errors object Active Records Basics

Question: If you want to make the errors object spit out the full error messages as an array of strings, then what method do you want to call?

Answer: object.errors.add(:name, "is dumb")

Message: Bummer! Think back on the Ruby course and how you'd ask an object to give back an Array version of itself. Pleas help

2 Answers

object.errors.to_a[:name, "is dumb"] 

The add method you used (.add) would just return the entire argument as a single element. Since you want to add an array (remember an array is a collection of objects (strings, numbers, classes ect.) ) the method to do this is to_a() the a is short for Array.

object.errors.full_messages

?