0

我正在尝试根据指定的 url 访问页面,但出现以下错误

SQLite3::SQLException:靠近“ILIKE”:语法错误:SELECT“pages”。* FROM “pages” WHERE('testimonials.html' ILIKE path || '%' AND path <> '') LIMIT 1

我正在尝试这样的事情

@page = Page.where("'#{params[:url]}' ILIKE path || '%' AND path <> ''").first

有什么建议么 ??

4

2 回答 2

0

By the very little i got your question i think you want something like following

@page = Page.where("(path LIKE '#{params[:url]}' OR path = '%') AND path != ''").first
于 2012-10-12T09:58:32.630 回答
0
   @page = Page.where("(path LIKE ? OR path = '%') AND path != ''",params[:url]).first
于 2012-10-12T11:43:10.177 回答