elight / acts_as_commentable_with_threading

Similar to acts_as_commentable; however, utilizes awesome_nested_set to provide threaded comments
MIT License
672 stars 167 forks source link

Rails 4.1.4 "ArgumentError: Unknown key: :order" #81

Closed eriknomitch closed 9 years ago

eriknomitch commented 10 years ago

ArgumentError: Unknown key: :order is happening on Comment.all and the commentable model's .comment_threads and .root_comments methods in Rails 4.1.4.

[1] pry(main)> Comment.all
ArgumentError: Unknown key: :order. Valid keys are: :class_name, :class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table
from /Users/erik/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/core_ext/hash/keys.rb:71:in `block in assert_valid_keys'
[2] pry(main)> Post.last.comment_threads
  Post Load (0.1ms)  SELECT  "posts".* FROM "posts"   ORDER BY "posts"."id" DESC LIMIT 1
ArgumentError: Unknown key: :order. Valid keys are: :class_name, :class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table
from /Users/erik/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-4.1.4/lib/active_support/core_ext/hash/keys.rb:71:in `block in assert_valid_keys'

Edit: I'd really like to add this into Prelang as soon as possible.

rogsmith commented 10 years ago

I am having the same issue. Did you find a solution?

eriknomitch commented 10 years ago

Nope, tried but I couldn't find anything... Not much mention of "order" in the Gem.

rogsmith commented 10 years ago

I think it may be coming from awesome_nested_set

eriknomitch commented 10 years ago

Very possible. I believe I swapped out that gem with their GitHub to no avail.

rogsmith commented 10 years ago

https://github.com/elight/acts_as_commentable_with_threading/pull/76

rogsmith commented 10 years ago

Add this in your Gemfile. will resolve it:

gem 'awesome_nested_set', '>= 3.0.0.rc.5'

petergoldstein commented 9 years ago

The 2.0.0 version of the gem depends on the released 3.0.0 version of awesome_nested_set, which fixes this issue. Please update to 2.0.0

vivek2007 commented 9 years ago

gems/ruby-2.2.0/gems/activesupport-4.2.0/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys': Unknown key: :order. Valid keys are: :class_name, :class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type (ArgumentError)

gonuguntla commented 4 years ago

gem 'awesome_nested_set', '2.0.0' - I used same way. Still facing same issue.