Class: Effective::Ballot
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Ballot
- Defined in:
- app/models/effective/ballot.rb
Instance Attribute Summary collapse
-
#current_step ⇒ Object
Returns the value of attribute current_step.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
Instance Method Summary collapse
-
#ballot_response(poll_question) ⇒ Object
Find or build.
- #completed? ⇒ Boolean
-
#submit! ⇒ Object
This is the review step where they click Submit Ballot.
- #to_s ⇒ Object
Instance Attribute Details
#current_step ⇒ Object
Returns the value of attribute current_step.
4 5 6 |
# File 'app/models/effective/ballot.rb', line 4 def current_step @current_step end |
#current_user ⇒ Object
Returns the value of attribute current_user.
3 4 5 |
# File 'app/models/effective/ballot.rb', line 3 def current_user @current_user end |
Instance Method Details
#ballot_response(poll_question) ⇒ Object
Find or build
64 65 66 67 |
# File 'app/models/effective/ballot.rb', line 64 def ballot_response(poll_question) ballot_response = ballot_responses.find { |br| br.poll_question_id == poll_question.id } ballot_response ||= ballot_responses.build(poll: poll_question.poll, poll_question: poll_question) end |
#completed? ⇒ Boolean
77 78 79 |
# File 'app/models/effective/ballot.rb', line 77 def completed? completed_at.present? end |
#submit! ⇒ Object
This is the review step where they click Submit Ballot
70 71 72 73 74 75 |
# File 'app/models/effective/ballot.rb', line 70 def submit! wizard_steps[:complete] ||= Time.zone.now self.completed_at ||= Time.zone.now save! end |
#to_s ⇒ Object
59 60 61 |
# File 'app/models/effective/ballot.rb', line 59 def to_s model_name.human end |