troubleshooting Question

Rails: creating a SQL view like model

Avatar of renderbox
renderboxFlag for United States of America asked on
Ruby
2 Comments1 Solution535 ViewsLast Modified:
I want to be able to create a new model object that behaves exactly the same as another model object.  An example is this:

TableA -> is the main database
AltA -> is the first "SQL-view-like" model (Uses the data in TableA)
AltB -> is the second "SQL-view-like" model (Uses the data in TableA)
Link -> The connection table that links the AltA and AltB tables with a HM:T relationship

In the Link table I'll have the columns: alta_id & altb_id that link the two records together.

What do I have to do to the AltA & AltB table models to make them behave as if they are real data sources and not "SQL-view-like" models?

I tried inheriting from the TableA model but it did not work as I expected.  It seemd to still think it was a "TableA" model.  I think I was missing something.

Thanks,
Grant
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros