Class: StructuredParams::Configuration
- Inherits:
-
Object
- Object
- StructuredParams::Configuration
- Defined in:
- lib/structured_params.rb
Overview
Global configuration for StructuredParams.
Options
array_index_base(Integer, default:0)-
Controls how array indices are displayed in human attribute names and error messages.
-
0– 0-based (raw Ruby index): “Hobbies 0 Name” -
1– 1-based (human-friendly): “Hobbies 1 Name”
-
This setting applies to both API param error messages and Form Object full_messages.
Example
# config/initializers/structured_params.rb
StructuredParams.configure do |config|
config.array_index_base = 1 # show "1st" instead of "0th" to users
end
Instance Attribute Summary collapse
-
#array_index_base ⇒ Object
: Integer.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
: () -> void.
Constructor Details
#initialize ⇒ Configuration
: () -> void
51 52 53 |
# File 'lib/structured_params.rb', line 51 def initialize @array_index_base = 0 end |
Instance Attribute Details
#array_index_base ⇒ Object
: Integer
48 49 50 |
# File 'lib/structured_params.rb', line 48 def array_index_base @array_index_base end |