Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,440 Points

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