On Martes, 12 de Enero de 2010 04:55:13 mobilemike escribió: > active_scaffold_config.list.columns = [:col1, :col2, ...] does not > work in a before filter. I think I found the correct class in the AS > source and there's comments that imply the are preventing that type of > behavior on purpose. I have not investigate the set_columns method.
active_scaffold_config.list.columns = [:col1, :col2, ...] does work in a before filter if you call set_columns after that, we are not preventing that behaviour. Each method used by views wants @columns variable set, so you have to use set_columns to set it. > > I'll report back if I have any success with that. > > On Jan 11, 3:32 am, "Sergio Cambra .:: entreCables S.L. ::." > > <[email protected]> wrote: > > On Sábado, 9 de Enero de 2010 00:43:19 mobilemike escribió: > > > I have a very wide table (around 50 columns with more looming every > > > day) and I currently only show a very smal subset in the list view. I > > > use AS to display data to end users, not for an admin interface. My > > > user community is clambering for access to different views on the > > > data; lists that show different subsets of columns based on tasks. > > > > > > I've had a lot of success using a before_filter to filter the rows > > > returned, but column filtering seems really hard right in AS. In this > > > post, > > >http://groups.google.com/group/activescaffold/browse_thread/thread/bb... > > >35834d49/6933e0463a73785d?lnk=gst&q=columns#6933e0463a73785d, there's a > > > snippet of code that can recursively exclude columns. I > > > supposed this code could be used to also add them, but it seems like > > > an awful lot of overhead. > > > > > > active_scaffold_config.list.columns.each { |col| > > > active_scaffold_config.list.columns.exclude col.name } > > > > > > I can see my app ending up with 10 or so views, and it would be much > > > simpler (and DRYer I think) to just explicitly set the columns > > > necessary for each of these views using a case statement. Has anyone > > > succeeded in doing this? Is there already a simple feature for doing > > > this that I'm overlooking? > > > > Have you tried to set list.columns to the array columns you need? > > active_scaffold_config.list.columns = [:col1, :col2, ...] > > Maybe you need to call > > active_scaffold_config.list.columns.set_columns(active_scaffold_config.co > >lu mns) after set list columns > > > > -- > > Sergio Cambra .:: entreCables S.L. ::. > > Mariana Pineda 23, 50.018 Zaragoza > > T)902 021 404F)976 52 98 07E) [email protected] -- 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.
