Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing commonly used rails snippets

  • Loading branch information...
commit 3e4b05e9f2e73dc67a1dc8a19996523e0890bcaa 1 parent e42aef3
Mike Enriquez enriquez authored committed
2  ruby-rails/hm.snippet
View
@@ -1 +1 @@
-has_many :<+object+>s<+, :class_name => "<+object+>", :foreign_key => "<+reference+>_id"+>
+has_many :${1:object}
2  ruby-rails/hmt.snippet
View
@@ -1 +1 @@
-has_many :<+association_name+>, :through => :<+join_association+><+, :source => '<++>'+>
+has_many :${1:object}, :through => :${2:object}
2  ruby-rails/ho.snippet
View
@@ -1 +1 @@
-has_one :${1:object}, :class_name => "${2:Class}", :foreign_key => "${3:class}_id"
+has_one :${1:object}
2  ruby-rails/va.snippet
View
@@ -1 +1 @@
-validates_associated :<+attribute+><+, :on => :<+:create+>+>
+validates_associated :${1:attribute}
2  ruby-rails/vao.snippet
View
@@ -1 +1 @@
-validates_acceptance_of :<+terms+><+, :accept => "<++>", :message => "<+terms_message+>"+>
+validates_acceptance_of :${1:terms}
2  ruby-rails/vc.snippet
View
@@ -1 +1 @@
-validates_confirmation_of :<+attribute+><+, :on => :<+create+>, :message => "<+should match confirmation+>"+>
+validates_confirmation_of :${1:attribute}
2  ruby-rails/ve.snippet
View
@@ -1 +1 @@
-validates_exclusion_of :<+attribute+><+, :in => <+%w( <+mov avi+> )+>, :on => :<+create+>, :message => "<+extension %s is not allowed+>"+>
+validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
2  ruby-rails/vf.snippet
View
@@ -1 +1 @@
-validates_format_of :${1:attribute}, :with => /${2:regex}/<+, :on => :<+create+>, :message => "<+is invalid+>"+>
+validates_format_of :${1:attribute}, :with => /${2:regex}/
2  ruby-rails/vi.snippet
View
@@ -1 +1 @@
-validates_inclusion_of :<+attribute+><+, :in => <+%w( <+mov avi+> )+>, :on => :<+create+>, :message => "<+extension %s is not included in the list+>"+>
+validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
2  ruby-rails/vl.snippet
View
@@ -1 +1 @@
-validates_length_of :<+attribute+>, :within => <+3..20+><+, :on => :<+create+>, :message => "<+must be present+>"+>
+validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
2  ruby-rails/vn.snippet
View
@@ -1 +1 @@
-validates_numericality_of :<+attribute+><+, :on => :<+create+>, :message => "<+is not a number+>"+>
+validates_numericality_of :${1:attribute}
2  ruby-rails/vu.snippet
View
@@ -1 +1 @@
-validates_uniqueness_of :<+attribute+><+, :on => :<+create+>, :message => "<+must be unique+>"+>
+validates_uniqueness_of :${1:attribute}
Please sign in to comment.
Something went wrong with that request. Please try again.