Skip to content

activescaffold/active_scaffold_config_list

 
 

Repository files navigation

This works with Rails >= 4.0 and ActiveScaffold >= 3.4.4
Version 3.3.x worked with Rails 3.2 and ActiveScaffold >= 3.4.4
Version 3.2.x worked with Rails 3.2 and ActiveScaffold >= 3.3.0

Usage:
active_scaffold :model do |conf|
  conf.actions.add :config_list
end


Overview

A plugin for Active Scaffold that provides the ability to choose the column to show in the scaffold list at run-time

The configuration data will be saved on the session. It can be saved on the DB defining a method to return a record
for current controller, or empty record if user has no list configuration, and setting config_list to use that method.

conf.config_list.save_to_user = :config_list_for

class User < ActiveRecord::Base
  has_many :list_configurations
  def config_list_for(controller_id, controller_name)
    list_configurations.where(:controller_id => controller_id).first_or_initialize # different columns on different nested or embedded conditions
    list_configurations.where(:controller_id => controller_name).first_or_initialize # one configuration for the controller, even embedded or nested
  end
end

The model storing list configuration must have a config_list text column storing the config list, and config_list_sort serialized text column.

Packages

No packages published

Languages

  • Ruby 81.8%
  • HTML 18.2%