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 98f8ba2 commit 9b63f85Copy full SHA for 9b63f85
lib/grape_entity/exposure/base.rb
@@ -106,7 +106,7 @@ def attr_path(entity, options)
106
end
107
108
def key(entity = nil)
109
- @key.respond_to?(:call) ? @key.call(entity) : @key
+ @key.respond_to?(:call) ? entity.exec_with_object(@options, &@key) : @key
110
111
112
def with_attr_path(entity, options)
spec/grape_entity/exposure_spec.rb
@@ -35,7 +35,7 @@
35
36
37
it 'returns the result if :as is a proc' do
38
- fresh_class.expose :name, as: -> (entity) { entity.object.name.reverse }
+ fresh_class.expose :name, as: -> { object.name.reverse }
39
expect(subject.key(entity)).to eq(model.name.reverse)
40
41
0 commit comments