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