Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken implicit sorting by join tables in v1.2.3 #158

Open
sasha-id opened this issue Jul 23, 2019 · 1 comment
Open

Broken implicit sorting by join tables in v1.2.3 #158

sasha-id opened this issue Jul 23, 2019 · 1 comment

Comments

@sasha-id
Copy link

This change in version 1.2.3 breaks implicit sorting by join tables aka join_table.column.
I guess the change was made to avoid SQL injections, but simple regex filter will work as well.

smart_listing/lib/smart_listing.rb

key = attr.to_s if @options[:array] || @collection.klass.attribute_method?(attr)
@korun
Copy link

korun commented Jul 24, 2019

Hi!
Then this regex should include all of database-specific identifier's quotes (like " for postgresql and others, backticks for some mysql, etc) and optional schema name?
For quick fix you can clearly specify sorting fields on smart_listing_create:

  sort_attributes: [
    [:column, 'join_table.column']
  ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants