refactor ruby on rails validations with new style

This commit is contained in:
babybeasimple 2013-05-31 23:42:10 +04:00
parent bd46e50148
commit 234ddb7e70

View File

@ -849,24 +849,24 @@ snippet tctss
${1} ${1}
snippet va snippet va
validates_associated :${1:attribute} validates_associated :${1:attribute}
snippet vao snippet va
validates_acceptance_of :${1:terms} validates :${1:terms}, :acceptance => true
snippet vc snippet vc
validates_confirmation_of :${1:attribute} validates :${1:attribute}, :confirmation => true
snippet ve snippet ve
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )} validates :${1:attribute}, :exclusion => { :in => ${2:%w( mov avi )} }
snippet vf snippet vf
validates_format_of :${1:attribute}, :with => /${2:regex}/ validates :${1:attribute}, :format => { :with => /${2:regex}/ }
snippet vi snippet vi
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi }) validates :${1:attribute}, :inclusion => { :in => %w(${2: mov avi }) }
snippet vl snippet vl
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20} validates :${1:attribute}, :length => { :in => ${2:3}..${3:20} }
snippet vn snippet vn
validates_numericality_of :${1:attribute} validates :${1:attribute}, :numericality => true
snippet vpo snippet vp
validates_presence_of :${1:attribute} validates :${1:attribute}, :presence => true
snippet vu snippet vu
validates_uniqueness_of :${1:attribute} validates :${1:attribute}, :uniqueness => true
snippet wants snippet wants
wants.${1:js|xml|html} { ${2} } wants.${1:js|xml|html} { ${2} }
snippet wc snippet wc