Skip to content
Browse files

Exclude position column from all actions

  • Loading branch information...
1 parent b564909 commit c4432179d9b33e822e1ded1e06ff3fc02d668c43 scambra committed Apr 15, 2010
View
5 lib/active_scaffold/actions/sortable.rb
@@ -11,8 +11,9 @@ def self.included(base)
config.columns.each {|c| c.sort = false unless c.name == sortable_column }
config.list.sorting = { sortable_column => "asc" }
- [:show, :list, :update, :create].each do |action_name|
- config.send(action_name).columns.exclude(sortable_column) if config.actions.include?(action_name)
+ config.actions.each do |action_name|
+ action = config.send(action_name)
+ action.columns.exclude(sortable_column) if action.respond_to? :columns
end
dir = File.join(Rails.root, 'vendor', 'plugins', ::Sortable.plugin_name, 'frontends')
View
2 test/config_test.rb
@@ -23,6 +23,8 @@ def test_position_column_not_included
assert !AutoModelsController.active_scaffold_config.update.columns.include?(:position)
assert !AutoModelsController.active_scaffold_config.create.columns.include?(:position)
assert !AutoModelsController.active_scaffold_config.show.columns.include?(:position)
+ assert !AutoModelsController.active_scaffold_config.subform.columns.include?(:position)
+ assert !AutoModelsController.active_scaffold_config.search.columns.include?(:position)
assert !SortableModelsController.active_scaffold_config.list.columns.include?(:name)
assert !SortableModelsController.active_scaffold_config.update.columns.include?(:name)
View
1 test/controllers/sortable_models_controller.rb
@@ -1,5 +1,6 @@
class SortableModelsController < ActionController::Base
active_scaffold :model do |config|
+ config.actions.exclude :search
config.actions << :sortable
config.sortable.column = :name
end

0 comments on commit c443217

Please sign in to comment.
Something went wrong with that request. Please try again.