Created
June 5, 2011 01:43
-
-
Save ybart/1008566 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Ranking.all(:order => Ranking.clip.name.asc, :links => [:clip]) | |
DataObjects::SyntaxError: no such column: clips.id (code: 1, sql state: , query: SELECT "rankings"."id", "rankings"."rank", "rankings"."progress", "rankings"."vote_count", "rankings"."votes", "rankings"."score", "rankings"."total", "rankings"."clip_id", "rankings"."jtop_id" FROM "rankings" INNER JOIN "rankings" "rankings_1" ON "clips"."id" = "rankings_1"."clip_id" ORDER BY "clips"."name", uri: sqlite3:/Users/ybart/Documents/Development/Rails/JTopStats/db/JTopStats_development.db?adapter=sqlite3&path=/Users/ybart/Documents/Development/Rails/JTopStats/db/JTopStats_development.db) | |
from /Library/Ruby/Gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:147:in `execute_reader' | |
from /Library/Ruby/Gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:147:in `read' | |
from /Library/Ruby/Gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection' | |
from /Library/Ruby/Gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:141:in `read' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/repository.rb:162:in `read' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/collection.rb:1117:in `lazy_load' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/lazy_array.rb:409:in `each' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/collection.rb:504:in `each' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/collection.rb:976:in `map' | |
from /Library/Ruby/Gems/1.8/gems/dm-core-1.1.0/lib/dm-core/collection.rb:976:in `inspect' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:302:in `output_value' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:151:in `eval_input' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:263:in `signal_status' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:147:in `eval_input' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:146:in `eval_input' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:70:in `start' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:69:in `catch' | |
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:69:in `start' | |
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in `start' | |
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in `start' | |
from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:23 | |
from script/rails:6:in `require' | |
from script/rails:6>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've found a blog post that helped me to solve my problem here. http://rhnh.net/2010/12/01/ordering-by-a-field-in-a-join-model-with-datamapper.
I query it this way :