Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-28 15:32:07 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-02 16:26:57 +0300
commitacfe394018df50bfc08aa9e41265231747675646 (patch)
tree776b34a9f27c149d8863775f760036b2484ed866 /app/serializers/request_aware_entity.rb
parent2023511753d75545aa76968a2991dc962f7a99db (diff)
Add PoC for resource serializers
Diffstat (limited to 'app/serializers/request_aware_entity.rb')
-rw-r--r--app/serializers/request_aware_entity.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/serializers/request_aware_entity.rb b/app/serializers/request_aware_entity.rb
new file mode 100644
index 00000000000..f6b6f64d0f8
--- /dev/null
+++ b/app/serializers/request_aware_entity.rb
@@ -0,0 +1,11 @@
+module RequestAwareEntity
+ # We use SerializableRequest class to collect parameters and variables
+ # from the controller. Because options that are being passed to the entity
+ # are appear in each entity in the chain, we need a way to access data
+ # that is present in the controller (see #20045).
+ #
+ def request
+ options[:request] ||
+ raise(StandardError, 'Request not set!!')
+ end
+end