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
684
684
``` ruby
685
685
params do
686
686
requires :id , type: Integer
687
- optional :text , type: String , regexp: /^ [a-z] +$ /
687
+ optional :text , type: String , regexp: /\A [a-z] +\z /
688
688
group :media do
689
689
requires :url
690
690
end
@@ -1152,7 +1152,7 @@ end
1152
1152
``` ruby
1153
1153
class AlphaNumeric < Grape ::Validations ::Base
1154
1154
def validate_param! (attr_name , params )
1155
- unless params[attr_name] =~ /^ [[:alnum:] ]+$ /
1155
+ unless params[attr_name] =~ /\A [[:alnum:] ]+\z /
1156
1156
fail Grape ::Exceptions ::Validation , params: [@scope .full_name(attr_name)], message: ' must consist of alpha-numeric characters'
1157
1157
end
1158
1158
end
You can’t perform that action at this time.
0 commit comments