The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Rails - validates_unlike plugin : validate that an attribute doesn't match against a RegExp

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Edgar Gonzalez

Posts: 560
Nickname: egg
Registered: Feb, 2006

Edgar Gonzalez is Chief Technology Officer for VALHALLA project
Rails - validates_unlike plugin : validate that an attribute doesn't match against a RegExp Posted: Jul 11, 2006 8:04 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Edgar Gonzalez.
Original Post: Rails - validates_unlike plugin : validate that an attribute doesn't match against a RegExp
Feed Title: La Cara Oscura del Desarrollo de Software
Feed URL: http://www.lacaraoscura.com/feed/
Feed Description: Our experiences day after day about software development: programming languages, standards, design patterns, tools and tips. (blog in spanish)
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Edgar Gonzalez
Latest Posts From La Cara Oscura del Desarrollo de Software

Advertisement
(versión en español) Working in rubycorner.com, I found myself needing to validate that a model attribute didn't match against some RegExp. My first approach was to define a validate method in my model: def validate   if my_field =~ /html|http|onclick|onmouseover/     errors.add("my_field", "should not contain html, http, onclick or onmouseover.")   end end But this approach is not DRY, so I create [...]

Read: Rails - validates_unlike plugin : validate that an attribute doesn't match against a RegExp

Topic: The dangers of #undef_method, #instance_exec recalled for memleaking! Previous Topic   Next Topic Topic: 19 Rails Tricks Most Rails Coders Don't Know

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use