Today, I would like to show how you my integeate recordselect into activescaffold for rails3.
I will use my players/team example as usual.
My example will show you how to use :record_select instead of :select for team association in players controller.

Let s start by adding recordselect to our application

rails plugin install https://github.com/vhochstein/recordselect.git 

Adding recordselect includes to application layout

<%= active_scaffold_includes %>
<%= record_select_includes %> 

Enabling recordselect in teams_controller

teams_controller.rb 

  class TeamsController < ApplicationController 
    record_select :per_page => 3, :search_on => [:name], : order_by => 'name' 
    ...

Adding recordselect routes for teams_controller

routes.rb 

  resources :teams do 
    as_routes
    record_select_routes 
  end 

Changing form_ui to :record_select for team column

players_controller.rb 

  active_scaffold :player do |conf| 
    conf.columns[:team].form_ui = :record_select
    ...

Restart your application and you should be able to choose a team for a player using record_select.

About these ads