Many of you know already that you may configure your inline actionlinks for singular associations columns.
Possible action values are :new, :show, :edit.

Let me show you a simple example. You would like to show “new” form in case player has nt got any team assigned and in case a team is assigned you would like to show “show” form

class PlayersController < ApplicationController
  active_scaffold :player do |conf|
    ....
    conf.columns[:team].actions_for_association_links = [:new, :show]
    ....
  end
end

I m using it quite often, however sometimes I was missing the option to show list view. That s why you have the following options these days: :new, :show, :edit and :list.

class PlayersController < ApplicationController
  active_scaffold :player do |conf|
    ....
    conf.columns[:team].actions_for_association_links = [:new, :list]
    ....
  end
end

Try it out. It s a shortcut for the user, all available information and actions for association model is just one click away and it s inline.

About these ads