diff --git a/snippets/eruby.snippets b/snippets/eruby.snippets index 9541835..bc13fcb 100644 --- a/snippets/eruby.snippets +++ b/snippets/eruby.snippets @@ -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 diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 1798e08..95eca9d 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -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}