Displaying 1 result from an estimated 1 matches for "decrement_sender_count".
2010 Feb 10
16
nil object - can anyone help?
...recipient, :class_name => ''User''
###validation
validates_presence_of :recipient_email
validate :recipient_is_not_registered
validate :sender_has_invitations, :if => :sender
before_create :generate_token
before_create :decrement_sender_count, :if => :sender
private
def recipient_is_not_registered
errors.add :recipient_email, ''Is already registered'' if
User.find_by_email(recipient_email)
end
def sender_has_invitations
unless sender.invitations_limit > 0
errors.add_to_base ''You hav...