Skip to content

Add rails callback methods #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 25, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change abbreviation to c for controller
  • Loading branch information
wongyouth committed Mar 14, 2014
commit 7924eee16b4bff6e3ca8745605bfc392e2915af1
38 changes: 22 additions & 16 deletions snippets/ruby.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -750,42 +750,46 @@ snippet mapwo
${0}
end

###########################
# controller snippets #
###########################

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

# after callback
snippet mav
snippet cav
after_validation :${0:method}
snippet maf
snippet caf
after_find :${0:method}
snippet mat
snippet cat
after_touch :${0:method}
snippet mac
snippet cac
after_create :${0:method}
snippet mau
snippet cau
after_update :${0:method}
snippet mas
snippet cas
after_save :${0:method}
snippet mad
snippet cad
after_destroy :${0:method}
snippet mrc

# around callback
snippet crc
around_create :${0:method}
snippet mru
snippet cru
around_update :${0:method}
snippet mrs
snippet crs
around_save :${0:method}
snippet mrd
snippet crd
around_destroy :${0:method}

snippet mcht
Expand Down Expand Up @@ -933,6 +937,8 @@ snippet mct
create_table :${1:table_name} do |t|
${0}
end
snippet mdt
drop_table :${1:table_name}
snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end
class ${1:class_name} < ActiveRecord::Migration
def up
Expand Down