Hi, you should nt use config.columns = [] config.columns is automatically filled with models attributes
You may add virtual columns: config.columns << :virtual_column You have to extend your model with a method for the virtual_column Associations have to be defined in the model If you need associated fields in your list view you may use virtual columms. Either use active records delegate inside of your model or do it on your own with a self written method. -- Volker On 22 Sep., 00:23, Soren <[email protected]> wrote: > Hi, > > I'm trying to put active scaffold into a controller that does not have > an underlying model. > > I therefore picked a model that had some of the fields already and > created a new controller like this: > > class XyzController < ApplicationController > > active_scaffold :users do |config| > > config.columns = [ ........ , :employer1, :employer2 ] > > Now I need some of the associated fields from another model. > > The only hint that I got from the API:Core document on the wiki is > that @user.user_group is the format for associated columns. > But when I use that I get: > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.employer1 > > Obviously I'm doing something really wrong - I just can not see what. > > The associations are working just fine User.find(...).form.employer1 > produces the right thing. > > Just to confirm - the associated models are done with ActiveRecord - > there is no requirement to have an ActiveScaffold controller for both > models ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
