diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-28 15:32:07 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-02 16:26:57 +0300 |
commit | acfe394018df50bfc08aa9e41265231747675646 (patch) | |
tree | 776b34a9f27c149d8863775f760036b2484ed866 /app/serializers/entity_request.rb | |
parent | 2023511753d75545aa76968a2991dc962f7a99db (diff) |
Add PoC for resource serializers
Diffstat (limited to 'app/serializers/entity_request.rb')
-rw-r--r-- | app/serializers/entity_request.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/serializers/entity_request.rb b/app/serializers/entity_request.rb new file mode 100644 index 00000000000..12ceb38b284 --- /dev/null +++ b/app/serializers/entity_request.rb @@ -0,0 +1,16 @@ +class EntityRequest + # We use EntityRequest object to collect parameters and variables + # from the controller. Because options that are being passed to the entity + # do appear in each entity object in the chain, we need a way to pass data + # that is present in the controller (see #20045). + # + def initialize(parameters) + merge!(parameters) + end + + def merge!(parameters) + parameters.each do |key, value| + define_singleton_method(key) { value } + end + end +end |