1
解決,見下文。:因爲我安裝了Bundler,因此Rails 2.3.9上的訂單根本不工作?
我的應用程序在Heroku上,他們最近took a ride of the ".gems"文件與Bundler一起使用「Gemfile」。
注意:我回到了舊的寶石系統,問題仍然存在。現在也是同樣的問題。
我做了改變,似乎一切正常,直到我注意到:訂單不工作了。
在控制檯
Users.find(:all)
User Load (13.3ms) SELECT * FROM `users`
User Columns (2.2ms) SHOW FIELDS FROM `users`
然後,如果以後我做
Users.find(:all, :order => "'created_at' ASC")
User Load (13.3ms) SELECT * FROM `users`
並返回相同的結果
Named_scope和使用的一切:爲了沒有按不再工作了。我必須使用find_by_sql對SQL請求進行硬編碼以臨時修復它。
任何幫助將不勝感激...
謝謝。
更新時間:
require 'rubygems'
source 'http://rubygems.org'
#source 'http://gemcutter.org'
#source 'http://gems.github.com'
gem 'rails', '2.3.9'
gem "bundler", "~> 1.0.15"
gem "builder", "3.0.0"
gem 'delayed_job', '2.0.7'
gem "hashie", "0.4.0"
gem "httparty", "0.6.1"
#gem "httparty", "0.5.0"
gem 'dalli' , '1.0.2'
gem 'calendar_date_select' , '1.16.1'
gem 'ckeditor' , '3.4.3'
gem 'fastercsv'
gem 'geokit' , '1.5.0'
gem 'hpricot' , '0.8.2'
gem 'will_paginate' , '2.3.14'
gem 'feed-normalizer' , '1.5.2'
gem 'memcached-northscale' , '0.19.5.3'
gem 'mysql' , '2.8.1'
gem 'less' , '1.2.21'
gem 'aws-s3'
gem 'paperclip'
gem 'pdfkit' , '0.4.6'
gem 'icalendar' , '1.1.5'
gem 'sitemap_generator'
gem 'taps' , '0.3.23'
gem 'geo_ip' , '0.3.1'
gem 'i18n'
更多的例子
User.find(:all,{ :order => "CREATED_AT DESC",:test => ""})
ArgumentError: Unknown key(s): test
User.find(:all,{:order => "CREATED_AT DESC"})
User Load (13.3ms) SELECT * FROM `users` (no order)
User.find(:all,{ :order => "CREATED_AT DESC",:conditions => "SCORE > 10000"})
User Load (13.3ms) SELECT * FROM `users` WHERE `score` > 10000 (no order again)
更多信息
- 搬回2.3.8沒有幫助
- :條件的作品,但不是:偏移
- 我的其他本地應用程序工作正常
User.find(:所有,:條件=> [ 「得分> 10000」])將產生 SELECT * FROM'users' WHERE(評分> 10000) 。 但User.find(:all,:conditions => [「score> 10000」],:order =>:score)會生成相同的SQL。訂單不起作用。 – Alextoul
我只是重新設置應用程序,而不使用捆綁軟件,仍然做同樣的事情...不知道它現在可能是什麼:( – Alextoul
我編輯了帖子,並添加了Gemfile(以防萬一) – Alextoul