collectiveidea/awesome_nested_set — Issue #97: rebuild! - connection.quote on column_name type raises exception (STI)
Author: brueckenschlaeger23
Created: 2011-10-20 19:13:44+00:00
State: open

We use single table inheritance and a scope on type. Unfortunately, using rebuild! we get an exception from our mysql adapter:

"cannot dump class Class" in to_yaml.

The problem is caused in line 171 in awesome_nested_set.rb

if acts_as_nested_set_options[:scope]
scope = lambda{|node|
scope_column_names.inject(""){|str, column_name|
str << "AND #{connection.quote_column_name(column_name)} = #{connection.quote(node.send(column_name.to_sym))} "
}
}
end

A fix consists in replacing node.send(column_name.to_sym) by node.send(column_name.to_sym).to_s

Any suggestions why not to do this? It has to be a string anyway.