Class: Invitation
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Invitation
- Defined in:
- app/models/invitation.rb
Instance Attribute Summary collapse
- #authenticating_user_email ⇒ Object
-
#authenticating_user_password ⇒ Object
Returns the value of attribute authenticating_user_password.
-
#existing_user ⇒ Object
Returns the value of attribute existing_user.
- #new_user_email ⇒ Object
-
#new_user_name ⇒ Object
Returns the value of attribute new_user_name.
-
#new_user_password ⇒ Object
Returns the value of attribute new_user_password.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #accept(attributes) ⇒ Object
- #account_name ⇒ Object
- #sender_email ⇒ Object
- #sender_name ⇒ Object
- #to_param ⇒ Object
Instance Attribute Details
#authenticating_user_email ⇒ Object
38 39 40 |
# File 'app/models/invitation.rb', line 38 def authenticating_user_email @authenticating_user_email ||= email end |
#authenticating_user_password ⇒ Object
Returns the value of attribute authenticating_user_password.
11 12 13 |
# File 'app/models/invitation.rb', line 11 def authenticating_user_password @authenticating_user_password end |
#existing_user ⇒ Object
Returns the value of attribute existing_user.
11 12 13 |
# File 'app/models/invitation.rb', line 11 def existing_user @existing_user end |
#new_user_email ⇒ Object
34 35 36 |
# File 'app/models/invitation.rb', line 34 def new_user_email @new_user_email ||= email end |
#new_user_name ⇒ Object
Returns the value of attribute new_user_name.
11 12 13 |
# File 'app/models/invitation.rb', line 11 def new_user_name @new_user_name end |
#new_user_password ⇒ Object
Returns the value of attribute new_user_password.
11 12 13 |
# File 'app/models/invitation.rb', line 11 def new_user_password @new_user_password end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
14 15 16 |
# File 'app/models/invitation.rb', line 14 def user @user end |
Instance Method Details
#accept(attributes) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/invitation.rb', line 22 def accept(attributes) self.attributes = attributes self.used = true @user = existing_user || authenticating_user || new_user if valid? transaction do save! save_and_create_membership(@user) end end end |
#account_name ⇒ Object
18 19 20 |
# File 'app/models/invitation.rb', line 18 def account_name account.name end |
#sender_email ⇒ Object
50 51 52 |
# File 'app/models/invitation.rb', line 50 def sender_email sender.email end |
#sender_name ⇒ Object
46 47 48 |
# File 'app/models/invitation.rb', line 46 def sender_name sender.name end |
#to_param ⇒ Object
42 43 44 |
# File 'app/models/invitation.rb', line 42 def to_param code end |