vendredi 6 novembre 2015

Rails 4 active record and models

I am somewhat rusty with rails let me explain what I was doing with PHP and maybe someone can help tell me the correct way in rails 4.

I have several DB tables (we can call them) foo, bar, mar Each table holds a different level of reports data. In PHP I crated a homepage that loads what I called a suite view which is a complex query that pulls data from the 3 tables to group it together. For a simple example every test run with an ID of foo gets pulled out and clumped in a suite. This is all done with SQL there is no Suite DB table it dos not exist.

In rails I made models for foo, bar and mar but I don't know how to make my suite code work. I would like a model that is called suite that is not based off a table but off a multi table query. then the view can interact with the model as normal?

Im not sure if thats possible or the correct way.

Aucun commentaire:

Enregistrer un commentaire