jackc / edge

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

`arel_table.columns` is deprecated in Arel 4.0.0 #3

Closed mrbanzai closed 11 years ago

mrbanzai commented 11 years ago

Currently getting errors when attempting to fetch the forest:

Loading development environment (Rails 4.0.0.rc1)
irb(main):001:0> User.where(:email => 'manager1@example.com').with_descendants
ArgumentError: wrong number of arguments (2 for 1)
    from /home/michael/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/activerecord-4.0.0.rc1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:172:in `columns'
    from /home/michael/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/arel-4.0.0/lib/arel/table.rb:111:in `columns'
    from /home/michael/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/edge-0.2.1/lib/edge/forest.rb:109:in `recursive_manager'
    from /home/michael/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/edge-0.2.1/lib/edge/forest.rb:98:in `with_descendants'

In investigating, it appears that there's a call in Arel::Table#columns that doesn't match the prototype for the schema statement in ActiveRecord 4.0.0. However, that method is marked as deprecated with a warning that it will be removed with no replacement.

I spent a bit of time trying to find a usable replacement for the arel_table.columns call in Edge::Forest#find_forest, but I'm not familiar enough with ActiveRecord / Arel.

jackc commented 11 years ago

I just pushed a rails4 branch. All the tests now pass with Rails 4.0.0.rc2, but I haven't tested it in a production app yet. Checkout that branch and let me know if it works for you.

mrbanzai commented 11 years ago

Sorry for the delay; works like a charm! Thanks for the really quick turnaround.