Comments (20)
I reproduce the error with your cloned repo, and I have similar issue. If you change your active_model_serializers
to 0.8.3
, all tests are passing.
gem 'active_model_serializers', '0.8.3'
from market_place_api.
@enilsen16 can you give me more details about the rspec
version you are running, I'm running specs from chapter 8 and they are running fine.
from market_place_api.
I'm using rspec 3.2.1
. rspec 2.x.x
was giving me errors and depreciations with rails 4.2.1
.
I had similar issues using active_model_serializers 0.8.0
and rails 4.2.1
.
my entire gemfile:
source 'https://rubygems.org'
gem 'active_model_serializers', git: 'https://github.com/rails-api/active_model_serializers.git'
gem 'coffee-rails', '~> 4.1.0'
gem 'compass-rails'
gem 'devise'
gem 'font-awesome-rails'
gem 'furatto'
gem 'jquery-rails'
gem 'rails', '4.2.1'
gem 'sabisu_rails', github: 'IcaliaLabs/sabisu-rails', branch: 'master'
gem 'sass-rails', '~> 5.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'simple_form'
gem 'uglifier', '>= 1.3.0'
group :development do
gem 'sqlite3'
end
group :development, :test do
gem 'byebug'
gem 'factory_girl_rails'
gem 'ffaker'
gem 'spring'
gem 'web-console', '~> 2.0'
end
group :test do
gem 'rspec-collection_matchers'
gem 'rspec-rails'
gem 'shoulda-matchers'
end
The repository can be found here: https://github.com/enilsen16/rails-devise-api
Any idea what's up?
from market_place_api.
I cannot reproduce the error, I cloned your repo and ran all the tests, and they all work. What are you doing exactly?
from market_place_api.
@kurenn Hmm... ok
git pull for the lastest code and then try. There should be 72 examples...
I really appreciate your help troubleshooting 😄
from market_place_api.
Did it worked?
from market_place_api.
No I still have these errors. I'll run through chapter 7 again, just to make sure I did everything right.
from market_place_api.
@enilsen16 try @florentferry solution and let me know how it goes!
from market_place_api.
@florentferry @kurenn Is it a syntax issue then with 'active_model_serializers', '0.10.0'
?
Now that I am using an older version everything passes.
from market_place_api.
No, the problem comes from the gem itself and/or dependencies with Rails 4.2 and RSpec 3. I check in active_model_serializers and find 0.8.3
works well with this stack.
from market_place_api.
Hi,
I'm not an expert but at GitHub's page for active_model_serializers says:
This [version 0.10.0] is not backward compatible with 0.9.0 or 0.8.0.
from market_place_api.
I was having the same problems and after having changed active_model_serializers to 0.8.3, as your suggestion, solved them.
I has caused problems on PRAX too: its Linux process was crashing. It's ok now.
Having read the console RSpec's output of the tests, it seems the version of active_model_serializers I had before caused some infinite loop and crashed. The output, may it be important:
~/projects/marketplaceapi$ bundle exec rspec spec/controllers/api/v1/products_controller_spec.rb
DEPRECATION WARNING: ** Notice: embed is deprecated. **
The use of .embed method on a Serializer will be soon removed, as this should have a global scope and not a class scope.
Please use the global .setup method instead:
ActiveModel::Serializer.setup do |config|
config.embed = :ids
config.embed_in_root = false
end
(called from class:UserSerializer at /home/pvc/projects/marketplaceapi/app/serializers/user_serializer.rb:2)
FFDEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (4 levels) in <top (required)> at /home/pvc/projects/marketplaceapi/spec/controllers/api/v1/products_controller_spec.rb:116)
...FFDEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (4 levels) in <top (required)> at /home/pvc/projects/marketplaceapi/spec/controllers/api/v1/products_controller_spec.rb:161)
...FFFFFFF.
Failures:
-
Api::V1::ProductsController POST #create when is successfully created renders the json representation for the product record just created
Failure/Error: post :create, { user_id: user.id, product: @product_attributes }
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:24:in `create'
./spec/controllers/api/v1/products_controller_spec.rb:94:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController POST #create when is successfully created
Failure/Error: post :create, { user_id: user.id, product: @product_attributes }
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:24:in `create'
./spec/controllers/api/v1/products_controller_spec.rb:94:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController PUT/PATCH #update when is successfully updated renders the json representation for the updated product
Failure/Error: patch :update, { user_id: @user.id, id: @product.id,
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:35:in `update'
./spec/controllers/api/v1/products_controller_spec.rb:141:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController PUT/PATCH #update when is successfully updated
Failure/Error: patch :update, { user_id: @user.id, id: @product.id,
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:35:in `update'
./spec/controllers/api/v1/products_controller_spec.rb:141:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController GET #show returns the information about a reporter on a hash
Failure/Error: get :show, id: @product.id
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:16:in `show'
./spec/controllers/api/v1/products_controller_spec.rb:9:in`block (3 levels) in <top (required)>'
-
Api::V1::ProductsController GET #show has the user as an embedded object
Failure/Error: get :show, id: @product.id
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:16:in `show'
./spec/controllers/api/v1/products_controller_spec.rb:9:in`block (3 levels) in <top (required)>'
-
Api::V1::ProductsController GET #show
Failure/Error: get :show, id: @product.id
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:16:in `show'
./spec/controllers/api/v1/products_controller_spec.rb:9:in`block (3 levels) in <top (required)>'
-
Api::V1::ProductsController GET #index when is not receiving any product_ids parameter returns 4 records from the database
Failure/Error: get :index
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:12:in `index'
./spec/controllers/api/v1/products_controller_spec.rb:41:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController GET #index when is not receiving any product_ids parameter returns the user object into each product
Failure/Error: get :index
SystemStackError:
stack level too deep./app/controllers/api/v1/products_controller.rb:12:in `index'
./spec/controllers/api/v1/products_controller_spec.rb:41:in`block (4 levels) in <top (required)>'
-
Api::V1::ProductsController GET #index when is not receiving any product_ids parameter
Failure/Error: get :index
SystemStackError:
stack level too deep
# ./app/controllers/api/v1/products_controller.rb:12:inindex' # ./spec/controllers/api/v1/products_controller_spec.rb:41:in
block (4 levels) in <top (required)>' -
Api::V1::ProductsController GET #index when product_ids parameter is sent returns just the products that belong to the user
Failure/Error: get :index, product_ids: @user.product_ids
SystemStackError:
stack level too deep
# ./app/controllers/api/v1/products_controller.rb:12:inindex' # ./spec/controllers/api/v1/products_controller_spec.rb:67:in
block (4 levels) in <top (required)>'
Finished in 2.33 seconds
18 examples, 11 failures
Failed examples:
rspec ./spec/controllers/api/v1/products_controller_spec.rb:97 # Api::V1::ProductsController POST #create when is successfully created renders the json representation for the product record just created
rspec ./spec/controllers/api/v1/products_controller_spec.rb:102 # Api::V1::ProductsController POST #create when is successfully created
rspec ./spec/controllers/api/v1/products_controller_spec.rb:145 # Api::V1::ProductsController PUT/PATCH #update when is successfully updated renders the json representation for the updated product
rspec ./spec/controllers/api/v1/products_controller_spec.rb:150 # Api::V1::ProductsController PUT/PATCH #update when is successfully updated
rspec ./spec/controllers/api/v1/products_controller_spec.rb:12 # Api::V1::ProductsController GET #show returns the information about a reporter on a hash
rspec ./spec/controllers/api/v1/products_controller_spec.rb:17 # Api::V1::ProductsController GET #show has the user as an embedded object
rspec ./spec/controllers/api/v1/products_controller_spec.rb:22 # Api::V1::ProductsController GET #show
rspec ./spec/controllers/api/v1/products_controller_spec.rb:44 # Api::V1::ProductsController GET #index when is not receiving any product_ids parameter returns 4 records from the database
rspec ./spec/controllers/api/v1/products_controller_spec.rb:49 # Api::V1::ProductsController GET #index when is not receiving any product_ids parameter returns the user object into each product
rspec ./spec/controllers/api/v1/products_controller_spec.rb:57 # Api::V1::ProductsController GET #index when is not receiving any product_ids parameter
rspec ./spec/controllers/api/v1/products_controller_spec.rb:70 # Api::V1::ProductsController GET #index when product_ids parameter is sent returns just the products that belong to the user
Randomized with seed 55815
from market_place_api.
I have exactly the same thing as @pedrovcenteno . Reading the DEPRECATION WARNING:
"The use of .embed method on a Serializer will be soon removed, as this should have a global scope and not a class scope."
I wonder then : does it still a good solution to use the embed ids and the old version of the gem or should we use something different such as the 'meta attribute' solution suggested by @kurenn in Box 7.2 ?
from market_place_api.
@RobinCaroff I would say it's fine as long you don't update to version 0.10, otherwise it will cause problems.
It is a good solution, the only thing with version 0.10 is that uses the new JSON API standard http://jsonapi.org/ but at the end of the day you choose how you want to structure the JSON response.
from market_place_api.
Hi, I just solve the problem, it's just the change of GET request syntax. You don't need rollback to old version active_model_serializers.
Try this:
get :show, params: { id: @product.id }
instead of
get :show, id: @product.id
Hope it is helpful. Good luck.
from market_place_api.
@RobinCaroff can you try with @AdamYang121's solution?
from market_place_api.
I was having the same problems and after having changed active_model_serializers to 0.8.3, as your suggestion, solved them. But I have a version of rails 6, ruby 2.6.5.
from market_place_api.
@shogmar Were you able to keep moving forward?
from market_place_api.
@shogmar Were you able to keep moving forward?
Yes, I changed the version to 0.8.3
from market_place_api.
Glad to read it!
from market_place_api.
Related Issues (20)
- Body is blank.? --I can not do DELETE/ POST / PUT / interface Sabisu_Rails HOT 3
- Listing: 6.5: Failure/Error: @user.destroy HOT 1
- Chapter 6 should_not be_published HOT 1
- Unable to access api endpoint (via cURL and in browser) HOT 1
- Found an error in the beginning of Chapter 8.1
- Latest updates of this project HOT 4
- Chapter 10 Pagination issue: Meta object in render json: products, meta: is not rendered in ActiveModelSerializer 0.10.2 HOT 1
- json render format; chapter 7 HOT 1
- Filter chain halted as :authenticate_with_token! rendered or redirected Completed 401 Unauthorized HOT 3
- Rspec test failing in Rails 5 HOT 6
- Rails 5.0.1: Sass::SyntaxError in SabisuRails::Explorer#index HOT 5
- Listing 5.12 HOT 3
- How do I do a log out(destroy the session) using cUrl? HOT 5
- 500 error when user not exist HOT 5
- sign_in in sessions controller does not affect tests HOT 4
- Chapter 6.1.3 Dependency Destroy Factory HOT 3
- I have been getting a 404 for the same request which is successful on another POSTMAN. HOT 1
- Chapter 6.2.6: ActionController::UrlGenerationError: No route matches {:action=>"destroy", :controller=>"api/v1/products" ... HOT 1
- Chapter 6 ActionController::UrlGenerationError:
- Chapter 5 Authentication Rails 5.2
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 market_place_api.