Replies: 2 comments
-
You can use the class Car < Sequel::Model
one_to_many :other_cars, class: self, dataset: proc{|r| r.associated_class.exclude(id: id)}
end |
Beta Was this translation helpful? Give feedback.
0 replies
-
Excellent, thanks very much. I was going through all the association doco's and did see that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This seems like it should be obvious.
Let's say I have a "Cars" table/model and I want have a one_to_many named "other_cars" that gets every other car but excludes the current car record. How does one do that exactly? I normally use the ":conditions" option to filter out unwanted records, but given the current record isn't something I can statically define, I'm not sure how to go about this.
Beta Was this translation helpful? Give feedback.
All reactions