Comments (5)
Additionally is my_resource.data
always nil
after Graphiti::Resource#build
.
Of course in the case I set raise_on_missing: false
here
from graphiti.
@dima4p , from our experience I can tell that it's not a good way to rely on resource.data
when the model is not yet saved. If you need to check authorization on the model instance creation step, there is a separate gem for it (assuming you are using ActionPolicy
).
from graphiti.
@dima4p , from our experience I can tell that it's not a good way to rely on
resource.data
when the model is not yet saved. If you need to check authorization on the model instance creation step, there is a separate gem for it (assuming you are usingActionPolicy
).
We are using Pundit. I think, that it is important to have the ability to use Graphiti::Resource#build#data to use the new model for authorization.
Now I have to keep in controller the method "#{singular_table_name}_params"
and create an additional instance of Model with #new in order to be able to authorize it.
from graphiti.
@dima4p , if you are using Graphiti under the hood, you can hook into model creation via the before_save
callback where you will have full access to the newly-built (but not yet saved) model
from graphiti.
@dima4p , one more thing: keep in mind that with JSON:API you have the ability to sidepost multiple resources in one request and thus you will have to either parse the whole resource tree yourself or rely on Graphiti with the approach I mentioned above
from graphiti.
Related Issues (20)
- sideposting - associating same newly created record with multiple records that are also being created
- Sideposting- includes don't show when test with Postman
- Polymorphic has_one and has_many doesn't respect custom polymorphic_name
- Data access questions HOT 1
- Missing next page link when the resource is a postgres table has json columns HOT 1
- Proposal to allow for overriding relationship getter HOT 1
- Record ID for authorization
- Guide - Outdated external link
- can not call method with args including keyword inside attribute/extra_attribute
- Problem in namespacing controllers HOT 2
- Template for tutorials are broken
- Parsing filter values with {{}} has unwanted side effects.
- Resources with circular relationships fail to load
- Can not call method with key args inside extra_attribute/attribute block HOT 4
- Deep Query Filter HOT 1
- Not compatible with Rails 7.1 HOT 3
- The automated release is failing 🚨
- The automated release is failing 🚨
- ActiveRecord::ConnectionTimeoutError "all pooled connections were in use" after enabling concurrency HOT 9
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 graphiti.