Sha256: 7b94836c0b4610b69d5aebf3d10da3a2d1da80f4433eb0aa6b525aeb3b0079c1
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
module ActiveScaffold::Config class Sortable < Base def initialize(core_config) @options = {} @core = core_config self.column = core_config.model.new.position_column unless (@core.model.instance_methods & [:acts_as_list_class, 'acts_as_list_class']).empty? self.column = core_config.model.new.left_column_name unless (@core.model.instance_methods & [:nested_set_scope, 'nested_set_scope']).empty? if self.column.nil? raise "ActiveScaffoldSortable: Missing sortable attribute '#{core_config.model.new.position_column}' in model '#{core_config.model.to_s}'" if @core.model.instance_methods.include? 'acts_as_list_class' raise "ActiveScaffoldSortable: Missing sortable attribute '#{core_config.model.new.left_column_name}' in model '#{core_config.model.to_s}'" if @core.model.instance_methods.include? 'nested_set_scope' end end cattr_accessor :plugin_directory @@plugin_directory = File.expand_path(__FILE__).match(%{(^.*)/lib/active_scaffold/config/sortable.rb})[1] self.crud_type = :update attr_reader :column def column=(column_name) @column = @core.columns[column_name] Rails.logger.error("ActiveScaffold Sortable: postion column: #{column_name} not found in model") if @column.nil? @column end attr_accessor :options end end
Version data entries
8 entries across 8 versions & 2 rubygems