We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3790bc2 commit af35d4aCopy full SHA for af35d4a
lib/grape_entity/exposure/base.rb
@@ -104,7 +104,7 @@ def attr_path(entity, options)
104
end
105
106
def key(entity = nil)
107
- @key.respond_to?(:call) ? @key.call(entity) : @key
+ @key.respond_to?(:call) ? entity.exec_with_object(@options, &@key) : @key
108
109
110
def with_attr_path(entity, options)
spec/grape_entity/exposure_spec.rb
@@ -33,7 +33,7 @@
33
34
35
it 'returns the result if :as is a proc' do
36
- fresh_class.expose :name, as: -> (entity) { entity.object.name.reverse }
+ fresh_class.expose :name, as: -> { object.name.reverse }
37
expect(subject.key(entity)).to eq(model.name.reverse)
38
39
0 commit comments