Skip to content

Instantly share code, notes, and snippets.

@bschaeffer
Last active September 12, 2015 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bschaeffer/bae070d46c5de47797ef to your computer and use it in GitHub Desktop.
Save bschaeffer/bae070d46c5de47797ef to your computer and use it in GitHub Desktop.
Rails 4 compatible #just_created?
class User < ActiveRecord::Base
attr_accessor :just_created
after_create :set_just_created
def just_created?
!!just_created
end
private
def set_just_created
self.just_created = true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment