问题
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