Skip to content

Commit 33513fc

Browse files
committed
WIP
1 parent d5756b2 commit 33513fc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/active_model/serializer.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ def self.attributes(*attrs)
116116
# def recent_edits
117117
# object.edits.last(5)
118118
# end
119+
# TODO: re-add block support
120+
# if block_given?
121+
# serialized_attributes[key] = ->(instance) { instance.instance_eval(&block) }
122+
# else
123+
# serialized_attributes[key] = ->(instance) { instance.object.read_attribute_for_serialization(attr) }
124+
# end
125+
#
126+
# ActiveModelSerializers.silence_warnings do
127+
# define_method key do
128+
# serialized_attributes[key].call(self)
119129
def self.attribute(attr, options = {}, &block)
120130
key = options.fetch(:key, attr)
121131
_attributes_map[key] = attr

0 commit comments

Comments
 (0)