That's exactly right.
And this:
config.columns[:vendor_name].sort = true
config.columns[:vendor_name].includes = [:vendor]
config.columns[:vendor_name].sort_by :sql => 'vendors.vendor_name'
works fine. It was the fact that the info. was spread across the
'includes' and 'sort_by' entries in the API that threw me off.
Thanks for the help.
Wes
naaano wrote:
> It seems to me that he's trying to sort by vendor_name on vendors
> associated table.
> So, he should do:
> config.columns[:vendor_name].includes = [:vendors]
> config.columns[:vendor_name].sort_by :sql => "vendors.vendor_name"
>
> Wes, double check AS:API:Column doc... your example is literal there.
>
> On Nov 3, 5:46 am, Ed W <[EMAIL PROTECTED]> wrote:
>
>> Wes Gamble wrote:
>>
>>> This doesn't work. If I do:
>>>
>>> config.columns[:vendor_name].sort_by :sql => '(SELECT vendor_name FROM
>>> vendors WHERE vendor_id = users.vendor_id)', then it generates this:
>>>
>>> SELECT * FROM `users` ORDER BY (SELECT vendor_name FROM vendors
>>> WHERE vendor_id = users.vendor_id) ASC LIMIT 0, 10
>>>
>>> which gives an error about subquery returning more than one row.
>>>
>> I think your problem is pretty obvious? If you can't say what you want
>> to sort on then how is the database supposed to sort the stuff for you?
>>
>> *What* are you trying to sort on?
>>
>> Ed
>>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---