Module: Ballot::ActionController
- Defined in:
- lib/ballot/action_controller.rb
Overview
Extensions to ActionController to support the use of Ballot in a Rails application.
Instance Method Summary collapse
-
#ballot_params(ballot = params[:ballot]) ⇒ Object
Provide a consistent way to extract ballot parameters from request parameters.
Instance Method Details
#ballot_params(ballot = params[:ballot]) ⇒ Object
Provide a consistent way to extract ballot parameters from request parameters. The ballot defaults to params[:ballot].
It permits:
-
Votables to be described by type and id (
:votable_type,:votable_id), a GlobalID locator (:votable_gid), or an object (:votable). -
Voters to be described by type and id (
:voter_type,:voter_id), a GlobalID locator (:voter_gid), or an object (:voter). -
The recorded vote (
:vote, a word or value that means true or false, see Ballot::Words). -
The scope for the vote (
:scope). -
The weight for the vote (
:weight).
22 23 24 25 26 27 28 29 30 |
# File 'lib/ballot/action_controller.rb', line 22 def ballot_params(ballot = params[:ballot]) ballot.permit( :votable_type, :votable_id, :votable_gid, :votable, :voter_type, :voter_id, :voter_gid, :voter, :vote, :scope, :weight ) end |