Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## With a callback
- class Foo < ActiveRecord::Base
- attr_reader :thing, :thang
- def after_initialize
- @thing = nasty_computation
- @thang = other_nasty_computation
- end
- end
- ## without a callback
- class Foo < ActiveRecord::Base
- def thing
- @thing ||= nasty_computation
- end
- def thang
- @thang ||= other_nasty_computation
- end
- end
Add Comment
Please, Sign In to add comment