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 ActiveRecord Basics Validation Errors 1

lm stuck on the first question, is it asking me to just name the method or to call it?

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?

object.errors.validate strings?

2 Answers

Hi Emmanuel,

We can do to convert arrays of strings into to_a, let's use this method.

object.errors.to_a[:username, "is wrong name!"]

More about Array (to_a)

http://ruby-doc.org/core-2.2.2/Array.html#method-i-to_a

http://apidock.com/ruby/Array/to_a

Hope that helps.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

You just have to add the method that converts errors to an array, nothing more. Just after the dot.