Module: ActiveRecord::Acts::List::NoUpdate

Defined in:
lib/acts_as_list/active_record/acts/no_update.rb

Defined Under Namespace

Modules: ClassMethods Classes: ArrayTypeError, DisparityClassesError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.applied_to?(klass) ⇒ Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/acts_as_list/active_record/acts/no_update.rb', line 98

def applied_to?(klass)
  !(klass.ancestors & extracted_klasses.keys).empty?
end

.apply_to(klasses) ⇒ Object



91
92
93
94
95
96
# File 'lib/acts_as_list/active_record/acts/no_update.rb', line 91

def apply_to(klasses)
  klasses.map {|klass| add_klass(klass)}
  yield
ensure
  klasses.map {|klass| remove_klass(klass)}
end

.included(base) ⇒ Object



8
9
10
# File 'lib/acts_as_list/active_record/acts/no_update.rb', line 8

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#act_as_list_no_update?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/acts_as_list/active_record/acts/no_update.rb', line 119

def act_as_list_no_update?
  NoUpdate.applied_to?(self.class)
end