Class: ActiveModel::Serializer::Fieldset
- Inherits:
-
Object
- Object
- ActiveModel::Serializer::Fieldset
- Defined in:
- lib/active_model/serializer/fieldset.rb
Instance Method Summary collapse
- #fields ⇒ Object
- #fields_for(serializer) ⇒ Object
-
#initialize(fields, root = nil) ⇒ Fieldset
constructor
A new instance of Fieldset.
Constructor Details
Instance Method Details
#fields ⇒ Object
9 10 11 |
# File 'lib/active_model/serializer/fieldset.rb', line 9 def fields @fields ||= parsed_fields end |
#fields_for(serializer) ⇒ Object
13 14 15 16 |
# File 'lib/active_model/serializer/fieldset.rb', line 13 def fields_for(serializer) key = serializer.json_key fields[key.to_sym] || fields[key.pluralize.to_sym] end |