Comments (3)
@omerpucit thanks for the report, but I don't see how this is related to jsonapi.rb
.
In fact, it's pretty clear that the error is somewhere within the way you set up things:
NoMethodError - undefined method `book.author_name' for #<Book
If it helps, I'm happy to review the serializer for the Book
, but there's little else I can do to help here.
I'll be closing this, but feel free to follow-up if you find anything I did miss.
from jsonapi.rb.
The issue was with the nested objects ( and with the rails method -> errors_object.generate_message ). Anyway, I have already fixed it for my own case.
attribute :detail do |object, params|
error_key, error_hash = object
errors_object = params[:model].errors
# Rails 4 provides just the message.
if false && error_hash[:error].present? && error_hash[:error].is_a?(Hash)
message = errors_object.generate_message(
error_key, nil, error_hash[:error]
)
elsif false && error_hash[:error].present?
message = errors_object.generate_message(
error_key, nil, error_hash
)
else
message = error_hash[:message]
end
errors_object.full_message(error_key, message)
end
from jsonapi.rb.
@omerpucit we do not support, nor plan to support nested resources/errors. And I generally do not recommend this pattern.
Glad you worked it out 🙏
from jsonapi.rb.
Related Issues (20)
- Use the gem without ActiveRecord HOT 2
- Error message have a blank value in the pointer field for model attributes with a underscore HOT 3
- Error on `jsonapi_pagination_meta` when using a grouped collection HOT 1
- Invalid filters return unfiltered results HOT 7
- Make Ransack a soft-dependency
- When using OJ, colons prepended to keys in the response HOT 3
- `Ransack::Visitor#visit_Ransack_Nodes_Sort` method visibility change HOT 1
- Includes don't seem to get paginated? HOT 1
- Field attributes containing patched predicates are mishandled HOT 1
- Using dot notation for relationship attributes when sorting HOT 3
- Rails 7.0 compatibility HOT 2
- Errors handling for development mode HOT 1
- JSONAPI::Rails.is_collection? confused by 'size' attribute HOT 2
- What am I missing in using jsonapi.rb to render json api? HOT 8
- warning to install ransack polute logs HOT 4
- allow any field for allow fields? HOT 2
- Option to specify the serializer explicitly HOT 2
- Let `code` be usable in error objects response HOT 3
- How to deserialize a collection? 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 jsonapi.rb.