Module: BlocksJsonSerialization
- Extended by:
- ActiveSupport::Concern
- Included in:
- User
- Defined in:
- app/models/concerns/blocks_json_serialization.rb
Overview
Overrides `as_json` and `to_json` to raise an exception when called in order to prevent accidentally exposing attributes
Not that would ever happen… but just in case.
Constant Summary collapse
- JsonSerializationError =
Class.new(StandardError)
Instance Method Summary collapse
- #to_json ⇒ Object (also: #as_json)
Instance Method Details
#to_json ⇒ Object Also known as: as_json
12 13 14 15 |
# File 'app/models/concerns/blocks_json_serialization.rb', line 12 def to_json(*) raise JsonSerializationError, "JSON serialization has been disabled on #{self.class.name}" end |