zorab47 / active_admin-sortable_tree

Show ActiveAdmin index as a nested tree with drag'n'drop
MIT License
162 stars 127 forks source link

undefined method `__sort_option__' for :ancestry:Symbol #45

Closed nahankid closed 8 years ago

nahankid commented 9 years ago

When trying to view a tree in ActiveAdmin, this is throwing error: _undefined method `sortoption' for :ancestry:Symbol

This doesn't work with the combination: Mongoid, mongoid-ancestry and active_admin-sortable_tree But works fine with ActiveRecord, Ancestry and active_admin-sortable_tree

Sample source code is at: https://github.com/nahankid/community

zorab47 commented 9 years ago

Would you provide a back trace when the error occurs? That helps focus my effort when searching for the issue.

nahankid commented 9 years ago

Hi Charles,

Thanks for getting back to me and Thanks for active_admin-sortable_tree. It’s a great gem.

I’ve asked this question on http://stackoverflow.com/questions/28786234/undefined-method-sort-option-for-ancestrysymbol, with offending code snippet and partial stack trace.

Thanks for your help

From: Charles Maresh [mailto:notifications@github.com] Sent: 01 March 2015 22:13 To: zorab47/activeadmin-sortable-tree Cc: nahankid Subject: Re: [activeadmin-sortable-tree] undefined method `sort_option' for :ancestry:Symbol (#45)

Would you provide a back trace when the error occurs? That helps focus my effort when searching for the issue.

— Reply to this email directly or view it on GitHub https://github.com/zorab47/activeadmin-sortable-tree/issues/45#issuecomment-76609899 . https://github.com/notifications/beacon/AFeVq3n8r5jt9U3GUWYkssFtXLJIaNKNks5nwzkWgaJpZM4DnfrE.gif

zorab47 commented 9 years ago

My best guess is to provide the sort direction as modetojoy mentioned in your StackOverflow post: undefined method 'sort_option' for :ancestry:Symbol

Try setting the sort direction directly by providing a hash to :sorting_attribute:

sortable tree: true, sorting_attribute: { :ancestry => :asc }, collapsible: true, start_collapsed: true
nahankid commented 9 years ago

Thanks. Tried that in vain

{:ancestry=>:asc} is not a symbol

From: Charles Maresh [mailto:notifications@github.com] Sent: 03 March 2015 09:22 To: zorab47/activeadmin-sortable-tree Cc: nahankid Subject: Re: [activeadmin-sortable-tree] undefined method `sort_option' for :ancestry:Symbol (#45)

My best guess is to provide the sort direction as modetojoy http://stackoverflow.com/users/1609937/modetojoy mentioned in your StackOverflow post: undefined method ' http://stackoverflow.com/questions/28786234/undefined-method-sort-option-for-ancestrysymbol sort_option' for :ancestry:Symbol

Try setting the sort direction directly by providing a hash to :sorting_attribute:

sortable tree: true, sorting_attribute: { :ancestry => :asc }, collapsible: true, start_collapsed: true

— Reply to this email directly or view it on GitHub https://github.com/zorab47/activeadmin-sortable-tree/issues/45#issuecomment-76882519 . https://github.com/notifications/beacon/AFeVq-FHP1f_fY4LETvUcWji3jFOKVtbks5nxSdJgaJpZM4DnfrE.gif

zorab47 commented 8 years ago

If you have any additional updates, please reopen this issue! Thanks.