:conditions => “LIKE ___%”语法

时间:2011-07-05 03:47:13

标签: ruby-on-rails activerecord

以下是错误:ArgumentError: malformed format string - %'

 named_scope :sales, :conditions => ["rolename LIKE 'salesteam%'"]

以下是可以的:

 named_scope :sales, :conditions => ["rolename LIKE 'salesteam%%'"]

我想知道在哪里可以找到%%(double%)语法的文档。

1 个答案:

答案 0 :(得分:3)

不应该这样吗?

named_scope :sales, :conditions => ["rolename LIKE ?", 'salesteam%']