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
Khor Hock Wan
4,212 PointsRuby Testing trouble with Validating Formatting
Im puzzled why the below code doesn't seem to return a pass on the test, my test keeps returning Failed assertion, no message given. I have gone through jason's second video but im still receiving this message. Thanks a million to those who can shed some light on this.
validates :first_name, presence: true
validates :last_name, presence: true
validates :profile_name, presence: true,
uniqueness: true,
format: {
with: /^[a-zA-Z0-9-_]+$/,
message: 'must be formatted correctly.'
}
3 Answers
Twiz T
12,588 PointsCan you post your assertions for this code?
-twiz
Jason Seifer
Treehouse Guest TeacherHey Khor Hock Wan we fix that in a later video. Sorry for the trouble!
Michael Norton
6,739 Pointsvalidates :first_name, presence: true
validates :last_name, presence: true
validates :profile_name, presence: true, uniqueness: true
has_many :statuses
def full_name first_name + " " + last_name end end