On Lunes, 20 de Junio de 2011 21:00:13 patrick99e99 escribió: > > Did you read documentation about sort and sort_by > > at:https://github.com/activescaffold/active_scaffold/wiki/API%3A-Column > > ?? > > Hi, > > Yes, I did.. I couldn't figure out how to get that to work.. I have > a method on my model which returns a number based off of calculations > done on some of the other columns in the database-- so this is a > virtual column. > > So I tried doing: > config.list.columns = [:my_virtual_column] > columns[:my_virtual_column].sort = true > columns[:my_virtual_column].sort_by :method => 'my_virtual_column' > > but I get the following error: > You have a nil object when you didn't expect it! > You might have expected an instance of Array. > The error occurred while evaluating nil.sort_by > > which I assume is because it's a virtual column.
You must add the virtual column to config.columns, then it will be added to all actions so you will have to exclude it from update and create actions -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] -- 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.
