table_builder icon indicating copy to clipboard operation
table_builder copied to clipboard

TableBuilder expects an Array or ActiveRecord::NamedScope::Scope but found a Array

Open dza2000 opened this issue 14 years ago • 1 comments

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.

dza2000 avatar Dec 04 '10 23:12 dza2000

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.

MDaubs avatar Jan 06 '11 17:01 MDaubs