-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathruby-rails.snippets
More file actions
38 lines (38 loc) · 1.09 KB
/
ruby-rails.snippets
File metadata and controls
38 lines (38 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Rails Model Associations
snippet bt
belongs_to :${1:model}${2}
snippet ho
has_one :${1:model}${2}
snippet hot
has_one :${1:model}, :through => :${2:model}${3}
snippet hm
has_many :${1:model}${2}
snippet hmt
has_many :${1:model}, :through => :${2:model}${3}
snippet habtm
has_and_belongs_to_many :${1:model}${2}
# Rails Model Validations
snippet vac
validates_acceptance_of :${1:attribute}${2}
snippet vas
validates_associated :${1:association}${2}
snippet vc
validates_confirmation_of :${1:attribute}${2}
snippet ve
validates_exclusion_of :${1:attribute}, :in => ${2:range}{$3}
snippet vf
validates_format_of :${1:attribute}, :with => /${2:regex}/{$3}
snippet vi
validates_inclusion_of :${1:attribute}, :in => ${2:range}{$3}
snippet vl
validates_length_of :${1:attribute}, ${2}{$3}
snippet vn
validates_numericality_of :${1:attribute}${2}
snippet vp
validates_presence_of :${1:attribute}${2}
snippet vps
validates_presence_of :${1:attribute}, :scope => ${2:scope}{$3}
snippet vu
validates_uniqueness_of :${1:attribute}${2}
snippet vus
validates_uniqueness_of :${1:attribute}, :scope => ${2:scope}{$3}