From 9371c648e18c765abdd811725fa57d73e937de00 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 12 Mar 2014 13:35:17 +0800 Subject: [PATCH] add rails callbak methods --- snippets/ruby.snippets | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 1798e08..e4be782 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -749,8 +749,45 @@ snippet mapwo ${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| ${0} end + +# 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 mac + after_create :${0:method} +snippet mau + after_update :${0:method} +snippet mas + after_save :${0:method} +snippet mad + after_destroy :${0:method} +snippet mrc + +# around callback + around_create :${0:method} +snippet mru + around_update :${0:method} +snippet mrs + around_save :${0:method} +snippet mrd + around_destroy :${0:method} + snippet mcht change_table :${1:table_name} do |t| ${0}