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

General Discussion

Testing the Profile Name - getting security risk, regular expression issue [RESOLVED]

Someone was already on top of it!

https://teamtreehouse.com/forum/confused-with-rails-4-format-validation-resolved

Cheers!

Hey there,

When I run the user_test after changing validates to:

validates :profile_name, presence: true, uniqueness: true, format: { with: /^[a-zA-Z0-9_-]+$/, message: 'Must be formatted correctly.' }

I get all sorts of non-sense :

...gems/activemodel-4.0.3/lib/active_model/validations/format.rb:46:in check_options_validity': The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option? (ArgumentError) from /Users/name/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activemodel-4.0.3/lib/active_model/validations/format.rb:20:incheck_validity!'

Any idea what the issue is here?