Thanks, Michael.
In newbie-talk, what worked for me is creating helpers/
associations_helper.rb:
module AssociationsHelper
def schedaction_column(record)
record.client_schedule.action
end
end
and then referring to the virtual column "schedaction" in my
controller:
class AssociationsController < ApplicationController
active_scaffold :associations do |config|
config.list.columns = [
:schedule_name,
:schedaction,
]
end
end
I knew it was easy. But it took me hours to figure out. Guess I need
to re-study the rails tutorials.
On Jan 27, 11:15 pm, Michael Latta <[email protected]> wrote:
> ALl you need is a method on the child that uses he association to the parent
> to return the value. Then create a "virtual" column to display that value.
> The docs cover how to create a virtual column.
>
> Michael
>
> On Jan 27, 2011, at 4:23 PM, Lindsay Morris wrote:
>
>
>
>
>
>
>
> > Thishasto beeasy...
> > My model:
> > Client_schedulehas-many :associations
> > and a field named "action"
> > Association belongs_to :client_schedule
>
> > When I list the child records, (associations), I want to display the
> > parent's "action" field too.
>
> > class AssociationsController < ApplicationController
> > active_scaffold :associations do |config|
> > config.list.columns = [
> > :schedule_name,
> > # how the heck do I do this?
> > :client_schedule.action
> > ]
> > end
> > end
>
> > Thanks in advance.
>
> > --
> > 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 [email protected].> To unsubscribe from this group,
> > send email [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/activescaffold?hl=en.
--
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.