module ActiveScaffold::MarkedModel
Public Class Methods
Source
# File lib/active_scaffold/marked_model.rb, line 5 def self.included(base) base.class_eval do extend ClassMethods scope :as_marked, -> { where(primary_key => marked_record_ids) } end end
This is a module aimed at making the make session_stored marked_records
available to ActiveRecord
models
Public Instance Methods
Source
# File lib/active_scaffold/marked_model.rb, line 12 def as_marked marked_records.include?(id.to_s) end
Source
# File lib/active_scaffold/marked_model.rb, line 16 def as_marked=(value) if [true, 'true', 1, '1', 'T', 't'].include?(value.respond_to?(:downcase) ? value.downcase : value) marked_records[id.to_s] = true unless as_marked else marked_records.delete(id.to_s) end end
Source
# File lib/active_scaffold/marked_model.rb, line 39 def marked_records self.class.marked_records end
Instance-level access to the marked_records