From time to time I was confronted with the following feature request by my users:
If I filter list view for a specific record, could nt you open a nested link automatically?

There a several approaches to achieve this and you have to decide if you would like to do it on server or client-side with corresponding pro’s and con’s.

I ve implemented a server side version which requires render_component plugin.
However, that one is installed automatically in my howto application.

Let me show you how it works in a quite short example:

class TeamsController < ApplicationController
  active_scaffold :team do |conf|
    conf.list.nested_auto_open = {:players => 1}

Our starting point is a nested link to players model.
Next line is doing all the magic, we configured that players nested link should be automatically opened if there is only 1 team record in list view.
You could also pick 2 or even 10 records in list views.

About these ads