File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -684,7 +684,7 @@ You can define validations and coercion options for your parameters using a `par
684684``` ruby
685685params do
686686 requires :id , type: Integer
687- optional :text , type: String , regexp: /^ [a-z] +$ /
687+ optional :text , type: String , regexp: /\A [a-z] +\z /
688688 group :media do
689689 requires :url
690690 end
@@ -1152,7 +1152,7 @@ end
11521152``` ruby
11531153class AlphaNumeric < Grape ::Validations ::Base
11541154 def validate_param! (attr_name , params )
1155- unless params[attr_name] =~ /^ [[:alnum:] ]+$ /
1155+ unless params[attr_name] =~ /\A [[:alnum:] ]+\z /
11561156 fail Grape ::Exceptions ::Validation , params: [@scope .full_name(attr_name)], message: ' must consist of alpha-numeric characters'
11571157 end
11581158 end
You can’t perform that action at this time.
0 commit comments