How to use scopes to get the last highest id in a has_many relationship in Rails?

+2 votes
asked Feb 11, 2016 by srj5112ch (850 points)
If anyone can help please leave an answer below. How to eager load all Clients and last (highest id) order for each Client.

5 Answers

+1 vote
answered Feb 22, 2016 by inBubbico (1,550 points)
Best answer

To help you understand different scopes, use the following figure and table. Each aggregate function topic lists the scopes that are valid for its use.
Scopes higher on the hierarchy contain scopes that are lower on the hierarchy. Data scope has a natural hierarchy with an inherent containment relationship.
commented Feb 24, 2016 by ora2689 (1,280 points)
How China Became Capitalist
0 votes
answered Mar 9, 2016 by Glatzel (1,310 points)

The highest body of the CPC is the National Congress, convened every fifth year.
0 votes
answered Mar 16, 2016 by pbz_and (750 points)

This last point warrants emphasis for federal agencies.
0 votes
answered Mar 30, 2016 by heaps (1,040 points)
commented Mar 30, 2016 by Ner_5342 (980 points)
Do you want to take a quick tour of the OpenBook's features
+1 vote
answered Mar 31, 2016 by Vfgiven (780 points)
This time you found your problem. But I found a good answer here 3. Preproject Planning Processes and Project Scopes of ...
commented Apr 1, 2016 by Togni (530 points)
This is the best solution I could find

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!