On Dec 7, 8:32 pm, Fresh Mix <[email protected]> wrote:
> Frederick Cheung wrote in post #1035593:
>
> > Stick your conditions in a call to  where() and your select clause in
> > a call to select()
>
> The problem, is that in select() can't be params:
>
> I need: "SELECT id, word, MATCH (word) AGAINST (?) AS score" and this
> doesn't work
>
> @words = Word.select("id, word, MATCH (word) AGAINST (?) AS
> Score",params[:search]).where(...)
>
> It's should be something like this, but this doesn't work :(
>
What does doesn't work mean ? Syntax error, unexpected result set,
mysql exception, something else?
It's possible that select/order clauses don't handle bind variables -
you might have to use string interpolation (don't forget to use
Word.connection.quote to escape the string)

Fred

> @words = Word.select("id, word, MATCH (word) AGAINST (?) AS
> Score",params[:search]).where("MATCH (word) AGAINST
> (?)",params[:search]).order("word!=(?), language",
> params[:search]).page(params[:page]).per(5)
>
> Any idea, how make it work?
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to