继承无法与葡萄实体及其= 0.5.0合作。
module API
module V1
module Entities
class A < Grape::Entity
expose :k
expose :l
expose :status
def status
'HI'
end
end
end
end
end
module API
module V101
module Entities
class A < V1::Entities::A
expose :status
def status
'BYE'
end
end
end
end
end
在这种情况下,使用葡萄的实用性,当我调用v101时,它正在调用status
v1
的功能,而不是v101
。这意味着 - 首先,它执行status
v1
的功能,然后是v101
。此代码完美地与Grape-entity 版本= 0.4.8
一起使用,其中仅调用v101
的函数。 版本&gt; = 0.5
此代码不像以前那样行事。我想念什么吗?谢谢你!
Related Configuration
rails: 5.2
grape: 1.6.2
module API
module V1
module Entities
class A < Grape::Entity
expose :k
expose :l
expose :status
def status
'HI'
end
end
end
end
end
module API
module V101
module Entities
class A < V1::Entities::A
expose :status
def status
'BYE'
end
end
end
end
end
In this case with grape-entity, when I am calling the V101 it is calling the status
function of V1
instead of the V101
at first. This means - first it is executing the status
function of v1
and then v101
. This code perfectly works with the grape-entity version = 0.4.8
where it only calls the function of v101
when I call with v101
. After version >= 0.5
this code does not behave as before. Ami I missing something? Thank you!
Related Configuration
rails: 5.2
grape: 1.6.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论