# File lib/active_scaffold/marked_model.rb, line 10 def as_marked marked_records.include?(self.id) end
# File lib/active_scaffold/marked_model.rb, line 14 def as_marked=(value) value = [true, 'true', 1, '1', 'T', 't'].include?(value.class == String ? value.downcase : value) if value == true marked_records << self.id if !as_marked else marked_records.delete(self.id) end end
Instance-level access to the #marked_records
# File lib/active_scaffold/marked_model.rb, line 34 def marked_records self.class.marked_records end
This is a module aimed at making the make session_stored #marked_records available to ActiveRecord models
# File lib/active_scaffold/marked_model.rb, line 5 def self.included(base) base.extend ClassMethods base.scope :as_marked, lambda { where(:id => base.marked_records.to_a) } end