app/models/membership.rb
# Return true if the person is member of the group.
Return true if the person is member of the group.
Return true if the person is member of the group .
def invite(user, group, send_mail = nil)
      if send_mail.nil?
        send_mail = global_prefs.email_notifications? &&
                    group.owner.connection_notifications?
      end
      if user.groups.include?(group) or Membership.exists?(user, group)
        nil
      else
        transaction do
          create(:user => user, :group => group, :status => INVITED)
          if send_mail
            membership = user.memberships.find(:first, :conditions => ['group_id = ?',group])
            Notifier.deliver_invitation_notification(membership)
          end
        end
        true
      end
    end
def invite ( user , group , send_mail = nil ) if send_mail . nil? send_mail = global_prefs . email_notifications? && group . owner . connection_notifications? end if user . groups . include? ( group ) or Membership . exists? ( user , group ) nil else transaction do create ( :user => user , :group => group , :status => INVITED ) if send_mail membership = user . memberships . find ( :first , :conditions => [ 'group_id = ?' , group ] ) Notifier . deliver_invitation_notification ( membership ) end end true end end
Return true if the person is member of the group.
Return true if the person is member of the group .
user
<not_specific>
group
<not_specific>
send_mail
<not_specific>