Comments (2)
Yes you could try that. We'll add support for associations eventually.
from rom-http.
Thanks for response!
Okay. Now here's the tricky part. Suppose I have an http relation:
class UsersRelation < ::ROM::Relation[:http]
gateway :my_awesome_gateway
schema(:users) do
attribute :id, Types::Int
attribute :login, Types::Strict::String
attribute :car_id, Types::Int
primary_key :id
end
def by_id(id)
with_path(id.to_s)
end
end
And an sql relation:
class CarsRelation < ::ROM::Relation[:sql]
gateway :my_precious_gateway
schema(:cars, infer: true)
dataset do
where(is_deleted: 0).order(:id)
end
def by_id(id)
where(id: id)
end
def for_users(_assoc, users)
where(id: users.map { |u| u[:car_id] })
end
end
So when I use users.by_id(id).combine_with(cars.for_users).one
it throws
ROM::MapperMisconfiguredError ([[:id], [:name], [:create_date], [:change_date], [:description]] attribute: block is required for :from with union value.):
where above-mentioned attributes are the attributes of an entity, representing a car in a database. Where should I look for the problem? I've read a lot of comments in gitter with the same problem, and I believe that the code should work.
from rom-http.
Related Issues (19)
- Release 0.2.0 HOT 2
- Add documentation for how to convert to a domain object HOT 7
- Make it easier to append parameters
- Override response handlers HOT 2
- Dataset should produce it's own URL HOT 1
- Provide basic JSON response handler
- Allow for multiple paths
- Syntax error when trying the extension example on Ruby 2.2 HOT 1
- Error when running the extending example on Ruby 2.3 HOT 1
- use schema plugin from rom core HOT 1
- Using input and output schemas in the gem HOT 3
- Release v0.6.0 has the wrong 'rom' dependency HOT 2
- Inferring schemas HOT 2
- Possibility to set up config in relation's definition HOT 2
- Document creating an adapter more thoroughly HOT 6
- Allow optional attributes in relation schemas HOT 3
- Add support for `meta` in dataset HOT 8
- Don't create schema every time it is applied 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 rom-http.