fix auto-counting with grouping

consider Item.group(:some_attr).paginate. since we're not providing
total_entries to the paginate call, it would try and use
Item.group(:some_attr).count as the total_entries. but that's going to
return a hash -- e.g. {'value1' => 12, 'value2' => 17, 'value3' => 9}.

when rows are actually returned, there's will be one row each per
'value1', 'value2', etc. so we're really concerned with the number of
unique values for the group by clause. select precisely that to use as
the total_entries before passing it along to Folio proper.

Change-Id: Ia94569b27891bf37f141bbddde59ba1000fe3309
immediately instantiate on paginate/page for AR

will_paginate 3.0 returns a relation from paginate(...). this allows
chaining of further relation modifiers. when the relation is finally
instantiated a WillPaginate::Collection is returned. however:

 (1) this is inconsistent with the will_paginate 2.3 behavior where
     paginate(...) immediately returns an instantiation of the scope as
     a WillPaginate::Collection obect.

 (2) this can cause unintentional errors with rails3's interpretation
     of, for example, map!. relation.map! { ... } on rails3 silently
     does nothing (I consider this a rails3 bug, but I'm just going to
     work around it for now). typically, you wouldn't call .map! on a
     relation; you'd call map, or you'd instantiate it first. but if the
     caller of paginate doesn't know it didn't instantiate, they may try
     to call map! and not achieve the desired effect.

the need to chain relation modifiers after paginate is rare, if it even
exists, and is easily worked around, while the detriments are subtle and
nasty. so we just break with WillPaginate and instantiate the (page of
the) relation immediately on paginate.

Change-Id: I7933c069a51932dbfd7b5f4ea08664a3fec7d2ac
fix auto-count for scopes having a having clause

Change-Id: I442386dcb483473397dce829e69b0422b4f90bfd
Merge "fix auto-count for scopes having a having clause"
ignore options[:per_page] == nil

otherwise per_page will end up being nil, causing 0 results to be returned

Change-Id: I30d0efb727152817b0c34c2581c17519f2a7a24f
bump version

Change-Id: Id453d4a34fbe9380d10f0e38a9de81ab2d674582