if I’ve two models.
Modela :has_many :modelbs
Modelb :belongs_to :modala
How can I use inner join to retrieve the data from the database, store them inside an array an return it back to the caller as a JSON string?
I understand there are find and related methods, but these methods seemed to be returning me array containing only objects of the class I did a find on (eg. Modela.find), and I will have to iterate through that array and and pull out Modelbs that belongs to Modela. Is there a easier way of doing it?
User
has_many :postsPost
belongs_to :userupdate Multiple users and their posts to json: