Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bf4 committed Dec 1, 2015
1 parent d5756b2 commit 33513fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/active_model/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ def self.attributes(*attrs)
# def recent_edits
# object.edits.last(5)
# end
# TODO: re-add block support
# if block_given?
# serialized_attributes[key] = ->(instance) { instance.instance_eval(&block) }
# else
# serialized_attributes[key] = ->(instance) { instance.object.read_attribute_for_serialization(attr) }
# end
#
# ActiveModelSerializers.silence_warnings do
# define_method key do
# serialized_attributes[key].call(self)
def self.attribute(attr, options = {}, &block)
key = options.fetch(:key, attr)
_attributes_map[key] = attr
Expand Down

0 comments on commit 33513fc

Please sign in to comment.