尝试搜索电影上映日期比今天大的地方 ) m' {4 t& r, g& x5 b Movie.where('release > ?', Date.today) " e' d2 K& t. Q8 o6 _) mActiveRecord::StatementInvalid: Mysql:arseError: 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 'release > '2011-09-25')' at line 1: SELECT `movies`.* FROM `movies` WHERE (release > '2011-09-25')% L& f3 a6 t) O7 B1 x) ^
, G L9 g; T( m2 h8 H解决方案: 8 ^5 }5 ~2 j* X6 d z/ N y5 ~6 l* K0 B5 G( P. X8 I U. e: {. U+ ~
, r8 y: g/ Q ^3 m$ i
Rails 3+:6 ^, @4 k6 {; ^/ O; Z
Movie.where('release > ?', DateTime.now) 8 g% ]- a4 ~" a* b+ h- c, ~0 V$ e; i6 ~4 m
预导轨3 4 F9 [( s6 x0 c0 }* {" rMovie.where(['release > ?', DateTime.now])