Class: Invitation
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Invitation
- Defined in:
- app/models/invitation.rb
Instance Attribute Summary collapse
- #existing_user_email ⇒ Object
-
#existing_user_password ⇒ Object
Returns the value of attribute existing_user_password.
- #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.
-
#new_user_password_confirmation ⇒ Object
Returns the value of attribute new_user_password_confirmation.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#existing_user_email ⇒ Object
36 37 38 |
# File 'app/models/invitation.rb', line 36 def existing_user_email @existing_user_email ||= email end |
#existing_user_password ⇒ Object
Returns the value of attribute existing_user_password.
9 10 11 |
# File 'app/models/invitation.rb', line 9 def existing_user_password @existing_user_password end |
#new_user_email ⇒ Object
32 33 34 |
# File 'app/models/invitation.rb', line 32 def new_user_email @new_user_email ||= email end |
#new_user_name ⇒ Object
Returns the value of attribute new_user_name.
9 10 11 |
# File 'app/models/invitation.rb', line 9 def new_user_name @new_user_name end |
#new_user_password ⇒ Object
Returns the value of attribute new_user_password.
9 10 11 |
# File 'app/models/invitation.rb', line 9 def new_user_password @new_user_password end |
#new_user_password_confirmation ⇒ Object
Returns the value of attribute new_user_password_confirmation.
9 10 11 |
# File 'app/models/invitation.rb', line 9 def new_user_password_confirmation @new_user_password_confirmation end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
12 13 14 |
# File 'app/models/invitation.rb', line 12 def user @user end |
Instance Method Details
#accept(attributes) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/invitation.rb', line 21 def accept(attributes) self.attributes = attributes @user = existing_user || new_user if valid? @user.save! @user.memberships.create!(:account => account, :admin => admin, :projects => projects) end end |
#account_name ⇒ Object
17 18 19 |
# File 'app/models/invitation.rb', line 17 def account_name account.name end |