ohho
ohho

Reputation: 51941

:conditions => "LIKE ___%" syntax

The following gives an error: ArgumentError: malformed format string - %':

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

The following is OK:

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

I am wondering where I can find the documentation for the %% (double %) syntax.

Upvotes: 1

Views: 2404

Answers (1)

Syed Aslam
Syed Aslam

Reputation: 8807

Shouldn't it be like this?

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

Upvotes: 3

Related Questions