Displaying 1 result from an estimated 1 matches for "invitation_limit".
2010 Feb 10
16
nil object - can anyone help?
...vitations
unless sender.invitations_limit > 0
errors.add_to_base ''You have reached your limit if invitations
to send''
end
def generate_token
self.token = Digest::SHA1.hexdigest([Time.now, rand].join)
end
def decrement_sender_count
sender.decrement! :invitation_limit
end
end
end
An invitations controller:
class InvitationsController < ApplicationController
def new
@invitation = Invitation.new
end
def create
@invitation = Invitation.new(params[:invitation])
@invitation.sender = user
if @invitation.save
flash[:notice] = "...