Guest User

Untitled

a guest
Jul 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. class Foo < ActiveRecord::Base
  2. # assume Foo has an attribute called "title"
  3.  
  4. before_save :my_callback
  5.  
  6. def my_callback
  7. self.title = "Prefix: #{self.title}" # this doesn't work if you remove "self" - why?
  8. end
  9. end
Add Comment
Please, Sign In to add comment