table_builder
table_builder copied to clipboard
TableBuilder expects an Array or ActiveRecord::NamedScope::Scope but found a Array
So, as you can read, TableBuilder is throwing an error because it expected an Array, but found an... Array. Not sure why this is throwing an exception. Any wisdom would be appreciated.
I'm willing to bet you are using Rails 3 and Arel, yes? If that's the case you are probably sending it an ActiveRecord::Relation. Adding a .all to the end of our query should fix the problem. Example:
# Do this
@widgets = Widget.where(:for_sale => true).all
# Instead of this
@widgets = Widget.where(:for_sale => true)
table_builder should probably be updated to support passing in a ActiveRecord::Relation.