Module: ViewComponentAttributes::WithAttributes
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Included in:
- WithContextAttributes, WithRoot, WithRootAttributes, WithUnknownAttributes
- Defined in:
- lib/view_component_attributes/with_attributes.rb
Instance Method Summary collapse
-
#attribute(name) ⇒ Object
Little gotcha as the internal @attributes AttributeSet used by ActiveModel::Model uses String keys.
Instance Method Details
#attribute(name) ⇒ Object
Little gotcha as the internal @attributes AttributeSet used by ActiveModel::Model uses String keys. github.com/rails/rails/blob/76489d81ba77216271870e11fba6889088016fa5/activemodel/lib/active_model/attributes.rb#L99 It’s very natural to use a Symbol here, so turning the name into a string to avoid pitfals
16 17 18 |
# File 'lib/view_component_attributes/with_attributes.rb', line 16 def attribute(name) super(name.to_s) end |