Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Support for 'sexy validations' #39

Merged
merged 1 commit into from

2 participants

Kostas Dizas Carlos Brando
Kostas Dizas

It has been quite some time since these DRY single line validations came out [http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/]
but there isn't any snippet for it. Here's one.

Carlos Brando carlosbrando merged commit 0095769 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 7, 2011
  1. Kostas Dizas
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 0 deletions.
  1. +24 −0 Snippets/validates.tmSnippet
  2. +2 −0  info.plist
24 Snippets/validates.tmSnippet
View
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>content</key>
+ <string>validates :${1:attribute}${2:, :acceptance =&gt; ${3:true}}${4:,
+ :confirmation =&gt; ${5:true}}${6:,
+ :exclusion =&gt; { :in =&gt; ${7:%w( ${8:mov avi} )} \}}${9:,
+ :inclusion =&gt; { :in =&gt; ${10:%w( ${11:mov avi} )} \}}${12:,
+ :format =&gt; { :with =&gt; /${13:^[${14:\w\d}]+\$}/ \}}${15:,
+ :length =&gt; { :minimum =&gt; ${16:0}, :maximum =&gt; ${17:0}, }}${18:,
+ :numericality =&gt; ${19:true}}${20:,
+ :presence =&gt; ${21:true}}${22:,
+ :uniqueness =&gt; ${23:true}}</string>
+ <key>name</key>
+ <string>validates</string>
+ <key>scope</key>
+ <string>source.ruby.rails</string>
+ <key>tabTrigger</key>
+ <string>v</string>
+ <key>uuid</key>
+ <string>996FEA3E-2255-4E7E-A551-BDA730D9E8B2</string>
+</dict>
+</plist>
2  info.plist
View
@@ -933,6 +933,7 @@
<string>5DAC28A7-33C8-4DA7-9E85-56618D6BEC9F</string>
<string>F5CBBE16-F5CC-4EDA-8BC6-30281BD7D854</string>
<string>5CE8838A-BF2C-497E-B87A-E90C3BC482E0</string>
+ <string>996FEA3E-2255-4E7E-A551-BDA730D9E8B2</string>
<string>A1776279-5396-4FE9-9218-8BF2C88C5271</string>
<string>44FBD811-70A9-462B-AC56-F975ADAD62AF</string>
<string>523BE8A6-0845-493D-A9B6-532F73D21950</string>
@@ -1000,6 +1001,7 @@
<string>AECD46CF-9031-4059-B386-262DBABD97B1</string>
<string>5694BA8B-64EC-4B1B-A00D-6366D28500C5</string>
<string>4EA6FBD1-CDEA-4DF6-9F70-A1EDA35AC3D7</string>
+ <string>46ECE243-0448-4A64-A223-27CC21E7704D</string>
</array>
<key>uuid</key>
<string>467A60E0-6227-11D9-BFB1-000D93589AF6</string>
Something went wrong with that request. Please try again.