range = "e-h"
Term.all(:conditions => ["name[0] = ?", range.split("-")[0]..range.split("-")[1]])
这会产生ActiveRecord::StatementInvalid: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[0] = 'e','f','g','h')' at line 1: SELECT
术语.* FROM
术语WHERE (name[0] = 'e','f','g','h')
如何从我的术语表中选择名称列的第一个字母在一系列字母之间?
谢谢。