Class: SimpleTeams::InvitationForm
- Inherits:
-
ApplicationForm
- Object
- ApplicationForm
- SimpleTeams::InvitationForm
- Defined in:
- app/forms/simple_teams/invitation_form.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#email ⇒ Object
Returns the value of attribute email.
-
#invitation ⇒ Object
Returns the value of attribute invitation.
-
#role ⇒ Object
Returns the value of attribute role.
-
#team ⇒ Object
Returns the value of attribute team.
Class Method Summary collapse
-
.invitation_attributes ⇒ Object
Attributes.
Instance Method Summary collapse
- #available_roles ⇒ Object
-
#initialize(team, current_user) ⇒ InvitationForm
constructor
A new instance of InvitationForm.
- #perform(params) ⇒ Object
Constructor Details
#initialize(team, current_user) ⇒ InvitationForm
Returns a new instance of InvitationForm.
6 7 8 |
# File 'app/forms/simple_teams/invitation_form.rb', line 6 def initialize(team, current_user) raise NotImplementedError end |
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
4 5 6 |
# File 'app/forms/simple_teams/invitation_form.rb', line 4 def current_user @current_user end |
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'app/forms/simple_teams/invitation_form.rb', line 4 def email @email end |
#invitation ⇒ Object
Returns the value of attribute invitation.
4 5 6 |
# File 'app/forms/simple_teams/invitation_form.rb', line 4 def invitation @invitation end |
#role ⇒ Object
Returns the value of attribute role.
4 5 6 |
# File 'app/forms/simple_teams/invitation_form.rb', line 4 def role @role end |
#team ⇒ Object
Returns the value of attribute team.
4 5 6 |
# File 'app/forms/simple_teams/invitation_form.rb', line 4 def team @team end |
Class Method Details
.invitation_attributes ⇒ Object
Attributes
22 23 24 |
# File 'app/forms/simple_teams/invitation_form.rb', line 22 def self.invitation_attributes [:email, :role] end |
Instance Method Details
#available_roles ⇒ Object
26 27 28 |
# File 'app/forms/simple_teams/invitation_form.rb', line 26 def available_roles @available_roles ||= SimpleTeams::Membership.roles end |
#perform(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/forms/simple_teams/invitation_form.rb', line 10 def perform(params) self.assign_attributes(params) if valid? invitation.update!(params) generate_notification else false end end |