Open pdipietro opened 9 years ago
Looks like a goofy feature of this gem. You can see it clearly at https://github.com/neo4jrb/neo4j-will_paginate_redux/blob/master/lib/neo4j-will_paginate_redux.rb#L48.
It doesn't respect String return
values. If you do it as a symbol, it does work, though.
@users = Neo4j::Session.query.match(query_string).proxy_as(User, :user).paginate(:page => first_page, :per_page => secondary_items_per_page, return: :"DISTINCT user",order: "user.last_name asc, user.first_name asc")
I expect that to work. In my test app with three Students connected to the same Lesson, this works:
Student.all.lessons(:l).paginate(page: 1, per_page: 2, return: :'distinct l')
We should add a case to accept a String, I don't know know why it wasn't there in the first place.
I tried a lot of variations with
with distinct
but with no result. Here is the code and the result, and I saw 2 starnge things: 1) there is no distinct clause in the generated query 2) there are 2 queries .... in the wrong orderand this is the console output
Below, you can find the query run in the web browser. As you can see, if I MANUALLY add the distinct clause there is only 1 item, as it should be.
So, maybe there is a BUG or aproblem on how to use correctly the DISTINCT CLAUSE in neo4j.rb