这里有错吗?我希望条目以http://amzn.com/w/开头,后跟任何内容。但是,无论我输入什么,我都会收到错误消息。
validates :wl_url, format: { with: /\A(http:\/\/amzn\.com\/w\/)+([a-z0-9]*)\z/,
message: 'Please make sure the Wish List code starts with http://amzn.com/w/, if unsure see "how it works" page for instructions.'}
答案 0 :(得分:0)
试试这个语法:
validates_format_of :wl_url, :with => /\A(http:\/\/amzn\.com\/w\/)+([a-z0-9]*)\z/i, :message => "Please make sure the Wish List code starts with http://amzn.com/w/, if unsure see "how it works" page for instructions."