Comments (3)
Thanks for feedback. This is a problem with most of the code examples, showing entire setup in every single example would produce too much noise, that's why it's best to start with intro docs that explain that at run-time you work with relation objects.
Soon we'll have more advanced code examples with tabs, where you'll be able to click on "Full example" (or something like this) where a complete, executable example will be shown.
I'm going to close this issue because this is a known problem and I'll be addressing it for sure.
from rom-rb.org.
Thanks for listening. I've been interested in trying ROM for a while, but I'm having a lot of trouble because it feels like I have to piece it together. The full picture isn't on any page of the guide. I've read the conceptual overview, but it's very high level and it left me with lots of dots I couldn't connect on my own. (It seems something I might find more meaningful after I've used ROM for a while.)
- What is the difference between
config.relation
andclass MyRelation <ROM::Relation[:sql]
? - The first pages say to define everything inside the
ROM.container
block which returns a "container" object, but subsequent examples show defining global classes outside of this block, such as repositories. What is the difference? How does the repository know about myrom
container if I don't pass it in? - Now that I have a "rom" container, what can I do with it? None of the example code uses it.
from rom-rb.org.
- What is the difference between config.relation and class MyRelation <ROM::Relation[:sql] ?
The former uses configuration DSL, which is suitable for scripts but not for applications. The latter, so defining classes explicitly, is a typical way of using ROM with applications.
- The first pages say to define everything inside the ROM.container block which returns a "container" object, but subsequent examples show defining global classes outside of this block, such as repositories.
Yeah this is super confusing. We should explain configuration with explicit classes as THE way of using ROM. Using configuration DSL isn't really common anymore (it used to be in the early days).
What is the difference?
The container block is a shortcut if you want to bootstrap rom runtime quickly in a script. Again, in applications you want to create rom configuration object, set up db connections and register components (or more commony use auto-registration with a directory that contains component files).
How does the repository know about my rom container if I don't pass it in?
Repositories receive rom containers in their constructors. It's up to you to handle that. ROM is often used in application based on dry-system, which supports constructor injection OOTB so things Just Work™.
Now that I have a "rom" container, what can I do with it? None of the example code uses it.
It gives you access to all initialized components. In an application you use it to access relations or to initialize repositories with it, most commonly. In some special cases you may access mappers and/or commands directly too.
I recommend joining our forum and/or chat and ask questions there.
from rom-rb.org.
Related Issues (20)
- Feedback on ROM - Rails Setup HOT 5
- Auto-struct with custom classes - undefined method HOT 2
- Feedback on ROM - Rails Setup
- Set up auto-deployment HOT 1
- Rom website has Content Security Policy errors in iframe HOT 3
- Missing docs for pagination plugin HOT 2
- Broken link in Advanced section
- Fix all broken links HOT 3
- Localisation: Brazilian Portuguese HOT 1
- Explain how auto-struct subclassing works
- Error when running "Repositories » Writing Aggregates" sample HOT 1
- Feedback on ROM - Status HOT 1
- Feedback on ROM - Mapping
- Feedback on ROM - Quick Start HOT 3
- Unclear documentation
- The "Edit on Github" link on rom-rb.org quick-setup points to the old rom-rb/rom-core github repository. HOT 1
- HTTP examples don't work HOT 6
- Feedback on ROM - Transactions HOT 3
- Feedback on ROM - Introduction
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 rom-rb.org.