Displaying 2 results from an estimated 2 matches for "monkey_id".
2006 Feb 06
4
Relationship Question (STI)
...but, they are unique enough to
break into their own models. I could use STI, but I think the table would
just have too many columns.
Now, I wanted to let the Dog''s, Whale''s and Monkey''s be buddies, and keep
track of their relationships.
I created a Buddies table (with monkey_id, dog_id, whale_id), and had
has_many relationships to link them all up.
This will work... however, if I wanted to list all of a Monkey''s Buddies...
it get''s tricky.
I have to query the Buddies table to get the relationships, then query both
the Whale and Monkey to get the appropri...
2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback.
first, .should_have_valid_associations
usage:
context "A new Product" do
specify "should have valid associations" do
@product.should_have_valid_associations
end
end
code: (thanks to Wilson/Defiler for converting to rspec)
module Spec
module Expectations
module Should