Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose attribute with name method does not work correctly #218

Closed
suddani opened this issue Apr 27, 2016 · 2 comments
Closed

expose attribute with name method does not work correctly #218

suddani opened this issue Apr 27, 2016 · 2 comments

Comments

@suddani
Copy link

suddani commented Apr 27, 2016

I have a JsonRPC object that looks like

{
 :method => String,
 :id => Integer,
 :jsonrpc => "2.0",
 :params => Hash
}

When i write an entity to expose those fields like

class Entity < Grape::Entity
      expose :method
      expose :id
      expose :jsonrpc
      expose :params
end

This does not work and throws wrong number of arguments (given 0, expected 1) for method
To work around this i have to write

class Entity < Grape::Entity
      # are you kidding me grape? i can't name my attribute method? really?
      expose :method do |instance,options|
        instance.method
      end
      expose :id
      expose :jsonrpc
      expose :params
end
@Linell
Copy link

Linell commented Apr 27, 2016

That should've actually been fixed by #217

@dblock
Copy link
Member

dblock commented Apr 27, 2016

Right on, I'll close this, @suddani please confirm that this is fixed or reopen the issue.

@dblock dblock closed this as completed Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants