Bryan,

Thank you. That makes sense, I was wondering why an array of models
converted to another array of models wouldn't work.  I did figure out that
any "find" statement would work. However, what I need to do is create a
subset of my model and then sort it and I can't seem to figure out how to
keep that "association"

So, my solution will have to be (unless anyone has any other ideas) to use
more detailed find statements.

Thanks for the help.
Johannes

On Wed, Mar 4, 2009 at 8:56 AM, Bryan Larsen <[email protected]> wrote:

>
>
> > In the controller, I have:
> >
> > def index
> >   if params[:report_type]
> >     case params[:report_type].first
> >     when "type1"
> >       @somelist = Model.all
> >     end
> >     hobo_ajax_response(@somelist)
> >   end
> > end
> >
> > However, if I replace that line in the controller "@somelist =
> > Model.all" to "@somelist = Model.all.first.to_a", I get the following
> > error: You have a nil object when you didn't expect it!
> > The error occurred while evaluating nil.name_attribute
> >
>
> The second form returns an array, the first, an Association.  An
> Association acts like an array, but also has a lot more capabilities,
> which it appears table-plus is using.
>
> Try this instead:  Model.find(:all, :limit => 1)
>
> Bryan
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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