Skip to content

Commit

Permalink
Merge pull request #320 from wongyouth/add_rails_methods
Browse files Browse the repository at this point in the history
Add rails callback methods
  • Loading branch information
taq committed Mar 25, 2014
2 parents 773c457 + fc65844 commit 3254ebf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions snippets/eruby.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ snippet ntc
<%= number_to_currency(${1}) %>
snippet ofcfs
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %>
snippet ofs
<%= options_for_select ${1:collection}, ${2:value_method} %>
snippet rf
<%= render :file => "${1:file}"${0} %>
snippet rt
Expand Down
41 changes: 41 additions & 0 deletions snippets/ruby.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,49 @@ snippet mapwo
${1:map}.with_options :${2:controller} => '${3:thing}' do |$3|
${0}
end

###############################
# model callback snippets #
###############################

# before callback
snippet mbv
before_validation :${0:method}
snippet mbc
before_create :${0:method}
snippet mbu
before_update :${0:method}
snippet mbs
before_save :${0:method}
snippet mbd
before_destroy :${0:method}

# after callback
snippet mav
after_validation :${0:method}
snippet maf
after_find :${0:method}
snippet mat
after_touch :${0:method}
snippet macr
after_create :${0:method}
snippet mau
after_update :${0:method}
snippet mas
after_save :${0:method}
snippet mad
after_destroy :${0:method}

# around callback
snippet marc
around_create :${0:method}
snippet maru
around_update :${0:method}
snippet mars
around_save :${0:method}
snippet mard
around_destroy :${0:method}

snippet mcht
change_table :${1:table_name} do |t|
${0}
Expand Down

0 comments on commit 3254ebf

Please sign in to comment.