Class: Monban::FieldMap
- Inherits:
-
Object
- Object
- Monban::FieldMap
- Defined in:
- lib/monban/field_map.rb
Overview
FieldMap is used to allow multiple lookup fields. For instance if you wanted to allow a user to sign in via email or username. This is used internally by the authenticate_session controller helper
Instance Method Summary collapse
-
#initialize(params, field_map) ⇒ FieldMap
constructor
A new instance of FieldMap.
-
#to_fields ⇒ Array, Hash
converts params into values that can be passed into a where clause.
Constructor Details
#initialize(params, field_map) ⇒ FieldMap
Returns a new instance of FieldMap.
9 10 11 12 |
# File 'lib/monban/field_map.rb', line 9 def initialize params, field_map @params = params @field_map = field_map end |
Instance Method Details
#to_fields ⇒ Array, Hash
converts params into values that can be passed into a where clause
18 19 20 21 22 23 24 |
# File 'lib/monban/field_map.rb', line 18 def to_fields if @field_map params_from_field_map else params_with_symbolized_keys end end |