jackc / edge

Edge provides graph functionality to ActiveRecord.
MIT License
90 stars 10 forks source link

Rails 6 Deprecation Warning from Rails 5.2 #22

Open raman162 opened 6 years ago

raman162 commented 6 years ago

Hello, using this gem I get this error when loading models

Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "\"module_elements\".\"position\" DESC". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql().

Thanks for all of the hard work on this gem, I dream of this functionality being baked into Rails.

jackc commented 6 years ago

See if branch rails-5.2-deprec-fix resolves it.

raman162 commented 6 years ago

Hello will do and let you know. Thanks!

raman162 commented 6 years ago

Hello, after further investigation, I don't believe it was your gem that was causing the errors. I did try out your branch and it broke my code.

Maybe one thing you can do when defining the class attribute forest_order is do some checking for the object type. I was originally setting it as a symbol and had to change it to a string. Or maybe you can tell people in the documentation to define order as a string.

Edit: Really sorry if I caused any inconvenience wasting your time, I should have done further debugging before accusing your gem as the culprit. Once again, Thanks a lot for your hard work on this gem. It's much appreciated.