| I really want an ActiveRecord-like experience. In ActiveRecord, I can do this: ```rb post = Post.find_by(author: "John Smith") post.author.email = "john@example.com" post.save ``` In React/Vue/Solid, I want to express things like this: ```jsx function BlogPostDetailComponent(...) { // `subscribe` or `useSnapshot` or whatever would be the hook that gives me a reactive post object
const post = subscribe(Posts.find(props.id));
function updateAuthorName(newName) {
// This should handle the join between posts and authors, optimistically update the UI
post.author.name = newName;
// This should attempt to persist any pending changes to browser storage, then
// sync to remote db, rolling back changes if there's a failure, and
// giving me an easy way to show an error toast if the update failed.
post.save();
}
return (
<>
...
</>
)
}``` I don't want to think about joining up-front, and I want the ORM to give me an object-graph-like API, not a SQL-like API. In ActiveRecord, I can fall back to SQL or build my ORM query with the join specified to avoid N+1s, but in most cases I can just act as if my whole object graph is in memory, which is the ideal DX. |
Here are some parallels your example:
A. ActiveRecord:
```
post = Post.find_by(author: "John Smith") post.author.email = "john@example.com" post.save
```
B. Instant:
```
db.transact( tx.users[lookup('author', 'John Smith')].update({ email: 'john@example.com' }), );
```
> In React/Vue/Solid, I want to say express things like this:
Here's what the React/Vue code would look like:
```
function BlogPostDetailComponent(props) {
}```