Merge pull request #320 from wongyouth/add_rails_methods

Add rails callback methods
This commit is contained in:
Eustáquio Rangel 2014-03-25 09:42:47 -03:00
commit 3254ebfb44
2 changed files with 43 additions and 0 deletions

View File

@ -107,6 +107,8 @@ snippet ntc
<%= number_to_currency(${1}) %> <%= number_to_currency(${1}) %>
snippet ofcfs snippet ofcfs
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %> <%= 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 snippet rf
<%= render :file => "${1:file}"${0} %> <%= render :file => "${1:file}"${0} %>
snippet rt snippet rt

View File

@ -749,8 +749,49 @@ snippet mapwo
${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| ${1:map}.with_options :${2:controller} => '${3:thing}' do |$3|
${0} ${0}
end 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 snippet mbs
before_save :${0:method} 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 snippet mcht
change_table :${1:table_name} do |t| change_table :${1:table_name} do |t|
${0} ${0}