mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-12-15 01:44:19 +00:00
first commit of a million rails snippets, conditions missing, command implementation missing...
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: bt
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: belongs_to
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
belongs_to :${1:object}${2:, :class_name => "${3:${1:$(replace-regexp-in-string "_" "" (capitalize yas/text))}}", :foreign_key => "${4:$1_id}"}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: habtm
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: has_and_belongs_to_many
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
has_and_belongs_to_many :${1:object}${2:, :join_table => "${3:table_name}", :foreign_key => "${4:$1_id}"}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: hm
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: has_many
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
has_many :${1:object}s${2:, :class_name => "${1}", :foreign_key => "${4:reference}_id"}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: hmt
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: has_many (through)
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
has_many :${1:objects}, :through => :${2:join_association}${3:, :source => :${4:$2_table_foreign_key_to_$1_table}}
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: hmd
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: has_many :dependent => :destroy
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
has_many :${1:object}s${2:, :class_name => "$1", :foreign_key => "${4:reference}_id"}, :dependent => :destroy$0
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# key: ho
|
||||
# contributor: Translated from TextMate Snippet
|
||||
# name: has_one
|
||||
## condition: "source.ruby.rails"
|
||||
# --
|
||||
has_one :${1:object}${2:, :class_name => "${3:${1/[[:alpha:]]+|(_)/(?1::\u$0)/g}}", :foreign_key => "${4:${1}_id}"}
|
||||
Reference in New Issue
Block a user