malformed format string - %

1,842 views
Skip to first unread message

abemore

unread,
Apr 17, 2008, 3:49:18 PM4/17/08
to ActiveScaffold : Ruby on Rails plugin
Hi,
I'm trying to get a custom always shown search box at the
top of the page and I understand I need "conditions_for_collection"
and wildcards (%) for that.

def conditions_for_collection
['tagline LIKE \'firetru%\'']
end

Trouble is, I get following error when I use "%" in a string:

malformed format string - %

In this similar thread:
http://groups.google.com/group/activescaffold/browse_thread/thread/ac62035d04ef74fb?tvc=2&q=malformed+format
Lance Ivy suggests the error is from a bug in AS and is fixed in the
trunk, but I installed the trunk and I still get the error. I tried
restarting the web server, and uninstalling the non-trunk version...
what am I doing wrong?

I appreciate any guidance anyone can give.

-abe

abemore

unread,
Apr 17, 2008, 4:02:21 PM4/17/08
to ActiveScaffold : Ruby on Rails plugin
Thank Google, I found the answer...

"Escape your % with %%, Rails uses sprintf (%) on the inside."

^_^

On Apr 17, 12:49 pm, abemore <abem...@gmail.com> wrote:
> Hi,
> I'm trying to get a custom always shown search box at the
> top of the page and I understand I need "conditions_for_collection"
> and wildcards (%) for that.
>
>  def conditions_for_collection
>    ['tagline LIKE \'firetru%\'']
>  end
>
> Trouble is, I get following error when I use "%" in a string:
>
> malformed format string - %
>
> In this similar thread:http://groups.google.com/group/activescaffold/browse_thread/thread/ac...
Reply all
Reply to author
Forward
0 new messages