ah, thanks for the clarification!

I like the syntax of :custodian => :name ... best documentation I
found on it is here: 
http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions.
(Doesnt show up in the new Agile Web Devel 3rd ed.)

As it stands with Hobo 0.8.7, adding set_default_order as shown
generates this error:

Processing FileSetsController#index (for 127.0.0.1 at 2009-05-31
20:31:43) [GET]
  ←[4;36;1mUser Load (1.0ms)←[0m   ←[0;1mSELECT * FROM `users` WHERE
(`users`.`id` = 5)
←[0m
  ←[4;35;1mFileSet Load (0.0ms)←[0m   ←[0mMysql::Error: Unknown column
'file_sets.custodianname' in 'order clause': SELECT * FROM `file_sets`
ORDER BY file_sets.custodianname LIMIT 0, 30←[0m

ActiveRecord::StatementInvalid (Mysql::Error: Unknown column
'file_sets.custodianname' in 'order clause': SELECT * FROM
`file_sets`  ORDER BY file_sets.custodianname LIMIT 0, 30):
  vendor/plugins/hobo/hobo/lib/hobo/model.rb:293:in `find_by_sql'
  vendor/plugins/hobo/hobo/lib/hobo/model.rb:286:in `find'
  vendor/plugins/hobo/hobo/lib/hobo/model.rb:59:in `paginate'
  vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:440:in
`find_or_paginate'
  vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:462:in
`hobo_index'
  vendor/plugins/hobo/hobo/lib/hobo/model_controller.rb:151:in `index'
  vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in `call'
  vendor/plugins/hobo/hobo/lib/hobo/controller.rb:22:in
`included_in_class'

Rendered rescues/_trace (52.0ms)
Rendered rescues/_request_and_response (0.0ms)
Rendering rescues/layout (internal_server_error)



On May 31, 6:42 pm, kevinpfromnm <[email protected]> wrote:
> Kind of off topic but the reason it has to be plural is that's how the
> table is named.  It passes the order value to create the sql query.
> Normally if you don't join another table you don't need to specify the
> table name.
>
> On May 27, 3:06 pm, Montgomery Kosma <[email protected]> wrote:
>
> > I have Collection object which belongs_to Custodian.  I'd like my
> > Collections to be grouped or ordered by custodian.name.
>
> > In vanilla rails, this works:
>
> > Collection.all(:include => :custodian, :order => "custodians.name")
>
> > Absent the :include option, I get an "unknown column
> > custodians.name"  (not sure why custodians has to be plural ...).
>
> > I get the same error in Hobo if I my Collection class specifies:
>
> > set_default_order "custodians.name"
>
> > I think the fix is to add the :include option to the default find
> > behavior.  Any way in Hobo to do that?  If not, should there be?
--~--~---------~--~----~------------~-------~--~----~
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