ddnexus/flex — pull request #3 by matchu (2013-01-18 23:04:27+00:00)
Title: Fix TypeError on pagination

`FlexSearch.some_query :page => 1, :size => 10` used to raise
"TypeError: nil can't be coerced into Fixnum".

That's because the `:from` computation used to be of the form
`(page - 1) * vars[:params][:size] || vars[:size] || 10`, which gets
operator precedence wrong: it's parsed the same as
`((page - 1) * vars[:params][:size]) || vars[:size] || 10`. So, if
`vars[:page]` is specified but `vars[:params][:size]` isn't, we
multiply a number by a nil, which raises an error.

We *could* just apply better grouping, but a new variable
declaration is more readable, anyway.