Comments (6)
Here is the full chain:
2.6.1 :002 > u = User.find('XXXX-XXXX')
ETHON: performed EASY effective_url=http://domain.com/v1/admin/users/XXXX-XXXX response_code=200 return_code=ok total_time=2.526228
D, [2019-02-18T08:43:05.160459 #67471] DEBUG -- : [httplog] Sending: GET
D, [2019-02-18T08:43:05.160681 #67471] DEBUG -- : [httplog] Data:
D, [2019-02-18T08:43:05.160856 #67471] DEBUG -- : [httplog] Status: 200
D, [2019-02-18T08:43:05.161028 #67471] DEBUG -- : [httplog] Benchmark: 2.526608 seconds
D, [2019-02-18T08:43:05.161482 #67471] DEBUG -- : [httplog] Response: (not showing binary data)
=> #<User(users/XXXX-XXXX) active=true full_name="Marcelo Drakeford " first_name="Marcelo" email="[email protected]" stripe_id="cus_Ch7PG7epplUbph" created_at="2018-04-17T02:03:51.260Z" updated_at="2018-10-20T22:55:55.303Z" utc_offset=-5 alpha_firmware_access=false beta_firmware_access=false expert_mode=false enable_remote_logging=false devices_count=1 user_device_offers_count=1 activities_count=0 stripe=nil payment={"exists"=>false, "current"=>false, "needed"=>true, "expired"=>true} id="1ecec758-5fb7-456c-b10f-70b2512821cc">
2.6.1 :003 > u.user_device_offers.all
=> #<Her::Model::Associations::HasManyAssociation:0x00007ff42ee7d1d0 @parent=#<User(users/1ecec758-5fb7-456c-b10f-70b2512821cc) active=true full_name="Marcelo Drakeford " first_name="Marcelo" email="[email protected]" stripe_id="cus_Ch7PG7epplUbph" created_at="2018-04-17T02:03:51.260Z" updated_at="2018-10-20T22:55:55.303Z" utc_offset=-5 alpha_firmware_access=false beta_firmware_access=false expert_mode=false enable_remote_logging=false devices_count=1 user_device_offers_count=1 activities_count=0 stripe=nil payment={"exists"=>false, "current"=>false, "needed"=>true, "expired"=>true} id="XXXX-XXXX">, @opts={:class_name=>"UserDeviceOffer", :name=>:user_device_offers, :data_key=>:user_device_offers, :default=>[], :path=>"/user_device_offers", :inverse_of=>nil}, @params={}, @klass=UserDeviceOffer, @name=:user_device_offers>
2.6.1 :004 > u.user_device_offers.first
ETHON: performed EASY effective_url=http://domain.com/v1/admin/users/XXXX-XXXX/user_device_offers response_code=200 return_code=ok total_time=0.011298
D, [2019-02-18T08:43:12.593182 #67471] DEBUG -- : [httplog] Sending: GET
D, [2019-02-18T08:43:12.593368 #67471] DEBUG -- : [httplog] Data:
D, [2019-02-18T08:43:12.593503 #67471] DEBUG -- : [httplog] Status: 200
D, [2019-02-18T08:43:12.593624 #67471] DEBUG -- : [httplog] Benchmark: 0.011605 seconds
D, [2019-02-18T08:43:12.593912 #67471] DEBUG -- : [httplog] Response: (not showing binary data)
Traceback (most recent call last):
1: from (irb):4
NoMethodError (undefined method `map' for nil:NilClass)
from her.
@zacharywelch figured it out. Since the model is UserDeviceOffers the serialized json root is userdeviceoffers
so I needed to add:
parse_root_in_json :userdeviceoffers
from her.
Do you have a sample response and the call which is producing the error?
from her.
@zacharywelch was that what you were looking for? Here's even more logs:
oMethodError: undefined method `map' for nil:NilClass
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/attributes.rb", line 182, in instantiate_collection
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/attributes.rb", line 193, in new_collection
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/http.rb", line 72, in block in get
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/http.rb", line 59, in request
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/http.rb", line 81, in get_raw
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/http.rb", line 70, in get
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/associations/association.rb", line 52, in fetch
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/associations/has_many_association.rb", line 86, in fetch
File "/home/vcap/deps/0/vendor_bundle/ruby/2.6.0/gems/her-1.1.0/lib/her/model/associations/association_proxy.rb", line 11, in tap
from her.
That should be enough @noctivityinc. Not sure why a separate request is made to pick up the first device offer since they should be cached after .all
. Tied up at the moment but I'll try and reproduce later.
from her.
from her.
Related Issues (20)
- path_prefix option is not used when belongs_to association is set. HOT 5
- add ability to wrap "where" clause HOT 4
- Support for first, limit, group and order HOT 6
- Support for update_attributes missing? HOT 6
- Support for association extensions HOT 1
- Class-level response parsing? HOT 1
- Scopes on JsonApi model
- Find or Create by ID HOT 2
- Have we considered making this gem more SEO friendly? HOT 4
- Attributes don't play nicely with ActiveModel::Dirty in Rails 6
- Safe Navigation Operator &. don't works on nil objects
- I would like to have find_by! in order to raise an exception instead of a nil HOT 1
- HashWithIndifferentUsage is slow, and requires large ActiveSupport dependency
- ruby 2.7, rails 6.0 and faraday 1.0 HOT 3
- Release version 1.1.1 HOT 1
- her-rb.org website inaccessible. HOT 1
- Organizing a fork of her HOT 1
- Execute rescue_from plus her? HOT 1
- Model.all returns empty array, but response has data HOT 1
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 her.