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

Nested exposure doesn't work #191

Closed
dmitry opened this issue Nov 13, 2015 · 5 comments
Closed

Nested exposure doesn't work #191

dmitry opened this issue Nov 13, 2015 · 5 comments
Labels

Comments

@dmitry
Copy link

dmitry commented Nov 13, 2015

This code:

class User < Grape::Entity
  expose :photo do |p|
    expose :large do
      p.photo.url(:large)
    end
  end
end

Returns:

NoMethodError (undefined method `expose' for #<API::User:0x00000023cdec68>):

grape-entity: v0.4.8
grape: v0.13.0

@dblock dblock added the feature label Nov 15, 2015
@dblock
Copy link
Member

dblock commented Nov 15, 2015

Did you try this on HEAD? I think the fixes and support for nested exposures hasn't been released yet. We have tests for this,

subject.expose :awesome do
.

cc: @idyll @marshall-lee maybe time to release 0.5.0 ...

@dmitry
Copy link
Author

dmitry commented Nov 15, 2015

I saw it, but haven't tried, as we are depending on https://github.com/ruby-grape/grape-swagger here. Thought it's available for 0.4.x as well, but the 0.5.x has better implementation of the nested exposures. Looks like I need to work on ruby-grape/grape-swagger#314 first :)

PS. That's why I thought it's similar on 0.5: https://github.com/ruby-grape/grape-entity/blob/0-4/spec/grape_entity/entity_spec.rb#L85
I've tried to write integration tests for the grape 0.13.0 and grape-entity 0.4.8 with nested exposures - and it was failed with the same error, as in the topic message (NoMethodError). Will try to run the same integration test code for grape-entity 0.5 tomorrow.

@namxam
Copy link

namxam commented Dec 16, 2015

@dmitry Have you managed to get this to work? I think we are currently running into the same issues here.

@dmitry
Copy link
Author

dmitry commented Dec 17, 2015

@namxam you can upgrade to 0.5, it should be fixed there. I've solved it by not using nested exposures :)

@dblock
Copy link
Member

dblock commented Dec 17, 2015

I believe this is fixed, closing.

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

No branches or pull requests

3 participants