text
stringlengths
1
330k
I have two tables with a join table between them:
Parent: Pages
Child: Things
Join: Grids
In my models they are set up with a many to many relationship (has_many through):
class Page < ActiveRecord::Base
belongs_to :books
has_many :grids
has_many :things, :through => :grids
class Thing < ActiveRecord::Base
has_many :grids
has_many :pages, :through => :grids
class Grid < ActiveRecord::Base
belongs_to :page
belongs_to :thing
Now I want to be able to sort "things" using an ordering id from grid, called number, how can I do that ?
share|improve this question
your definition of the Thing model is missing –  Tilo Oct 8 '11 at 13:13
Apologies.. it's the relationship between page and things, not the book, I fixed it in the original post : ) –  jakobk Oct 8 '11 at 14:43
add comment
1 Answer
up vote 2 down vote accepted
you need the ":include(s)" option in your find method, and then "order_by()" ...
you would use something like this:
Thing.where(...some condition or all..., :include => :grid ).order_by(grid.number)
share|improve this answer
Should that be has_many :pages, :through => :things? –  mliebelt Oct 8 '11 at 14:16
And is that ...order_by(grid.number) valid? What is that grid in that context? Should it be ...order_by('grid.number')? –  mliebelt Oct 8 '11 at 14:21
Thanks! - It worked except it's ".order(grids.number)" Also great links, just what I've been looking for .. –  jakobk Oct 8 '11 at 14:42
add comment
Your Answer
Click photo to enlarge
Leon Panetta, the outgoing secretary of defense, was a longtime congressman representing the Central Coast.
At least one member of the Monterey City Council would like to see the city's conference center named after Monterey native son and Washington, D.C., power player Leon Panetta.
Councilwoman Libby Downey said late Tuesday that she wanted the subject of renaming the Monterey Conference Center after Panetta scheduled for discussion on a future agenda.
Panetta, the outgoing secretary of defense, has been CIA director, budget director, White House chief of staff and a longtime congressman representing the Central Coast during his long career in national politics.
The council didn't comment on Downey's suggestion, other than Mayor Chuck Della Sala asking whether she meant a room in the conference center or the entire complex.
The whole thing, Downey said.
Della Sala wondered if the city has any policies that may prevent naming public buildings after people while they are still alive.
The answer to that question wasn't immediately available, but City Clerk Bonnie Gawf said any policies covering the matter would be provided to the council when it considers whether to move ahead with the suggestion.
The conference center at One Portola Plaza opened in April 1977 as a centerpiece of the city's downtown renewal program. The city is looking at major renovations to the complex to keep it competitive in the conference market.
Larry Parsons can be reached at 646-4379 or
Email this article to a friend
Dressing the royal bump: As our lookalike shows, Kate can look good every step of the way - and not a frumpy tent in sight!
* indicates fields that are mandatory.
Security code
A day after a House committee rejected a bill to repeal the death penalty, state Rep. Rhonda Fields killed her own measure asking voters to decide in 2014 whether to abolish the death penalty.
The Aurora Democrat admitted that her bill was a strategic counter to the proposal to abolish the death penalty.
"I don't think the death penalty should be repealed," Fields said.
The Spot Blog
Two of the three men sitting on Colorado's death row were convicted of killing Fields' son. Fields said she feared that if the bill to repeal the death penalty had succeeded, it would have given the governor and others motivation to commute the death sentences of her son's killers to life in prison.
The House Local Government Committee, which Fields chairs, honored her request to kill House Bill 1270.
"This is not something that will go away tomorrow or next year," said Rep. Jonathan Singer, D-Longmont. "We'll continue to struggle with this ethically and legislatively."
One of the arguments against the death penalty is that it disproportionately impacts minorities, especially blacks. But Fields, who is black, said that line of reasoning doesn't sway her.
"The death penalty has nothing to do with race," she said. "It has everything to do with murder and accountability for crimes committed."
Her son, Javad Marshall-Fields, and his fiancée, Vivian Wolfe, were gunned down while driving in Aurora in 2005. The two were set to testify in a pending murder case. Sir Mario Owens and Robert Ray are both on Colorado's death row for their involvement in the murders.
The House Judiciary Committee voted 6-4 Tuesday to kill the bill repealing the death penalty. Rep. Claire Levy, D-Boulder, said she had the votes to pass House Bill 1264 out of committee and the House until Democratic Gov. John Hickenlooper last week expressed his concerns about the bill, and brought up a veto.
Dawnspire: Prelude Image
Mixed or average reviews - based on 7 Critics What's this?
User Score
No user score yet- Awaiting 2 more ratings
Your Score
0 out of 10
Rate this:
• 10
• 9
• 8
• 7
• 6
• 5
• 4
• 3
• 2
• 1
• 0
• 0
• Summary: Dawnspire: Prelude is a fast-paced tactical action-RPG set in an original fantasy setting. The game features team-based online action with five original playable classes, global rankings, full guild support, a unique and challenging game mode and a dedicated community fully supported through the game. [GamersGate] Expand
Score distribution:
1. Positive: 0 out of 7
2. Negative: 2 out of 7
1. With the lack of a more complex skill development system, I found the clicky happy combat became repetitive fairly quickly. [May 2007, p.69]
2. A good, cheap laugh, and if you can get some friends to play, it's worth giving it a whirl. [July 2007, p.78]
3. Dawnspire is an action RPG in the vein of "Diablo," spiced up with capture-the-flag action but lacking most of the addictive fun of that great hackfest.
4. Dawnspire is like a cross between "Diablo" and "Gauntlet," but neither game was meant to be played with bots.
5. This is very cheap, fleeting PvP combat. [May 2007, p.90]
6. If you are unfazed by the inevitable, constant death, the steep learning curve, the idiot AI, the poorly-designed (but neat looking) maps, the certain index finger cramps, or the underdeveloped character creation system, you will find Dawnspire to be a unique (and economic) gaming experience.
7. It's a disappointing purchase despite the low price and free online gaming, and the desire to create a simple, team-to-team beat 'em up has been Silent Grove's undoing.
Score distribution:
1. Positive: 1 out of 1
2. Mixed: 0 out of 1
3. Negative: 0 out of 1
1. ehb
Jun 7, 2009
This is a much undertated minor master piece. it captures the essence of frantic team based pvp perfectly. it's fantasy setting at the time of its release something that was underused till then. it deserved a sequel to expand on the ideas that silent grove had put in place. something with a bigger budget. these 5 men created a great game that sadly did not recieve the audience it deserved. It can still be found today to play for free and i would recommend everyone try it. Expand
Histological evidence of carcinoma in a hepatic tumour associated with oral contraceptives.
Br Med J 1975; 4 doi: http://dx.doi.org/10.1136/bmj.4.5995.496 (Published 29 November 1975)
Cite this as: Br Med J 1975;4:496
1. M Davis,
2. B Portmann,
3. M Searle,