Hi Matt,

Well, I thought I knew Ruby pretty well, but in the mixin example you gave below, I can't figure out what SomeObject should be.

In my case, in the Document model:

def documents_for_review
  ary =  # did this during one of my iterations at trying to make it work.

  def ary.member_class
*Document ????????*
  end
  self.this = ary
end

and in the controller:

  hobo_index Document.documents_for_review

Thanks,

Don Z.

On 5/10/2011 9:35 PM, Matt Jones wrote:
On May 10, 2011, at 6:24 PM, Donald R. Ziesig wrote:

Hi Tiago,

hobo_index Document.all.map { |d| d.review_required? }

undefined method `default_order' for #<Array:0xb38ca844>

I think this was the same error I got during one of the iterations where I 
manually filtered the output of Document.find(:all) into an array.

Don Z.
The issue is in find_or_paginate - it's trying to figure out what order to sort 
the results in and breaking as a result. We should probably check 
responds_to?(:default_order) in there.

For now, you're probably better off just setting 'this' explicitly - hobo_index 
isn't doing much else for you:

def some_method
   self.this = ...build an arbitrary collection...
end

If you're using table-plus, you'll also want to give the array the ability to 
respond to member_class, or you'll get more errors:

def some_method
   ary = ...build an arbitrary collection...
   def ary.member_class
     SomeObject
   end
   self.this = ary
end

--Matt Jones


--
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to