zorab47 / active_admin-sortable_tree

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

Routing problem with "news" model name #12

Closed AntonAL closed 10 years ago

AntonAL commented 11 years ago

I have a model Pages::News, index route for this model will be "news_index_path". When I registering sortable in ActiveAdmin…

ActiveAdmin.register Pages::News do
  sortable
  index as: :sortable do
    label :title
  end
end

…I'm getting following error:

NoMethodError - undefined method `sort_admin_pages_news_path' for #<#<Class:0x007f974b9a4888>:0x007f974edb84a8>:
  actionpack (4.0.0) lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
  actionpack (4.0.0) lib/action_dispatch/routing/polymorphic_routes.rb:135:in `polymorphic_path'
  actionpack (4.0.0) lib/action_view/routing_url_for.rb:87:in `url_for'
  arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing'
   () Users/AntonAL/.rvm/gems/ruby-1.9.3-p448/bundler/gems/activeadmin-sortable-tree-53e60889f3c7/lib/active_admin/views/index_as_sortable.rb:50:in `build_list'
   () Users/AntonAL/.rvm/gems/ruby-1.9.3-p448/bundler/gems/activeadmin-sortable-tree-53e60889f3c7/lib/active_admin/views/index_as_sortable.rb:24:in `build'

This is because, instead of "sort_admin_pages_news_path", "sort_admin_pages_news_index_path" should be used.

nebirhos commented 10 years ago

Can you please try to pull the new commits? It should be fixed by #15

AntonAL commented 10 years ago

Ok, I will test it. Thanks!

nebirhos commented 10 years ago

I assume this is fixed now