Rails 3 ActiveRecord chaining

﹥>﹥吖頭↗ 提交于 2020-01-01 11:57:35

问题


I'm new to Rails and I'm not sure why my chaining isn't working.

Working

my_model.select('name').where('status_id = 6').all

Not Working

my_model.select('name').where('status_id = 6').order('name')

Why does chaining the order after the where not execute the query? I've tried adding the .all after the .order but that didn't seem to work either.


回答1:


Looks like this is a known bug in the jdbc adapter: http://kenai.com/jira/browse/ACTIVERECORD_JDBC-154

If you make these changes it will fix it: https://github.com/ystael/activerecord-jdbc-adapter/commit/8815d2fe133afb6774ebe12cc27c3a977dbf7ad2



来源:https://stackoverflow.com/questions/5357458/rails-3-activerecord-chaining

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!