Comments (3)
Agree with your points. I think I was facing a case where I couldn't eager load in the controller for some reason. Let me see if I can come up with a better example. Thanks!
from blueprinter.
Thanks for bringing this up @toobulkeh. Should eagerloading an association be the responsibility of Blueprinter or should the ActiveRecord object passed to Blueprinter be already eagerloaded?
I think it should already be eagerly loaded before being passed to Blueprinter. Having Blueprinter eagerload the association could be tricky. For example, developers may not be aware that Blueprinter already eagerloads for them (unless you make it optional). Additionally, eagerload can be pretty complex, especially cases where it is not obvious that an eagerload is needed. For example:
# inside a User.rb model
class User < ActiveRecord::Base
has_one :dog
def dog_name
dog.name
end
end
# inside a UserBlueprint
field :dog_name # Blueprinter would not know to eagerload this
Pinging @dlcarter @AllPurposeName for their thoughts
from blueprinter.
Closing this issue for the same reason as closing #96
Re-open if you think otherwise.
from blueprinter.
Related Issues (20)
- Best practice to cast a string field to integer? HOT 1
- association scope HOT 2
- Just a thank you! 🎉 HOT 1
- Make field naming more consistent HOT 7
- Incorrect Transform Documentation HOT 2
- Default date serialization HOT 3
- Dynamic Blueprint
- Error when use alias for fields (or method) with ? at the end HOT 1
- is there a way to pass variables between fields procs? HOT 2
- Is anyone keeping this project alive? HOT 31
- uninitialized constant Blueprinter::EmptyString HOT 4
- is there a way to delegate the options for nested associations? HOT 2
- JSON API specification HOT 1
- Pass `view` to associations HOT 6
- Transformer mutates original hash
- Discussion of a stable reflection API HOT 3
- Something weird when using transform. Use case: to lower camelCase HOT 2
- lazy load for association HOT 3
- Render one blueprint inside another? HOT 2
- Is there a way to exclude fields and associations and pass/process a block HOT 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 blueprinter.