Comments (6)
Your end
seems to be in the wrong line. attr_not_on_wrapped_object
is a method of the module and not of the class.
from grape-entity.
^^^ @dspaeth-faber
from grape-entity.
You're right! Sorry, my fault. :-)
from grape-entity.
I encountered a new problem with Runtime Exposure after I fixed this first mistake.
It only occours when I add :project_url to expose.
1) V1::Users GET /api/v1/users/:id/unconfirmed_tasks returns Tasks
Failure/Error: get "/api/v1/users/#{ user.id }/unconfirmed_tasks"
ArgumentError:
ArgumentError
# ./spec/api/users_spec.rb:38:in `block (3 levels) in <top (required)>'
module V1
module Entities
class Tasks < Grape::Entity
expose :id, :description, :project_id, :project_url
end
def project_url
'http://db.no/'
end
end
end
describe V1::Users do
describe 'GET /api/v1/users/:id/unconfirmed_tasks', focus: true do
it 'returns Tasks' do
get "/api/v1/users/#{ user.id }/unconfirmed_tasks" # Line 38
array.first['project_url'].should eq 'http://db.no/'
end
end
from grape-entity.
Same issue again. project_url
is not a method of the class Tasks
from grape-entity.
Sorry, I'm being a bit slow here. 😳
from grape-entity.
Related Issues (20)
- How to get the specified expose
- Adding default value to expose
- Version 0.8 compatibility with grape 1.3.1 HOT 3
- Why docs suggest strings for root option? HOT 1
- Sending an array of hash HOT 1
- Proxy API modeling HOT 1
- Grape::Entity#as_json does not return a recursive set of hashes.
- Ruby 3: Entities exposing fields via Symbol#to_proc are broken HOT 3
- Frozen/Deadlocked Ruby thread instead of NoMethodError HOT 1
- expose_nil option doesn't respect Entity.hash_access
- Same name nested arguments get value from root HOT 5
- Inheritance issue with the entity HOT 2
- Inheritance issue with the grape-entity version >= 0.5.0
- `FetchableObject` can cause unexpected behavior HOT 4
- Override Grape Entity Model Description
- Truncate Formatter
- Expose default value doesn't work for me HOT 2
- `expose_nil:` conflicts with options passing to a block
- `route.entity` can not get entity class in Rails 7.1
- Custom Entity options support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grape-entity.