lib/janus/models/trackable.rb in janus-0.6.0 vs lib/janus/models/trackable.rb in janus-0.7.0

- old
+ new

@@ -1,36 +1,39 @@ require 'janus/hooks/trackable' module Janus module Models # = Trackable - # + # # Simple hook to update some columns of your model whenever a user logs in. - # + # # == Required columns - # + # # - +sign_in_count+ # - +current_sign_in_ip+ # - +current_sign_in_at+ # - +last_sign_in_ip+ # - +last_sign_in_at+ - # + # module Trackable extend ActiveSupport::Concern included do - attr_protected :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip + begin + attr_protected :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip + rescue + end end def track!(ip) self.sign_in_count += 1 - + self.last_sign_in_at = self.current_sign_in_at self.last_sign_in_ip = self.current_sign_in_ip - + self.current_sign_in_at = Time.now self.current_sign_in_ip = ip - + save(:validate => false) end end end end