Sha256: 4c25b2df1ecf69c6c6161bcafc3fa155c6407fde44d356a0cff4f8d21733a1cc
Contents?: true
Size: 763 Bytes
Versions: 12
Compression:
Stored size: 763 Bytes
Contents
# Users can represent other subjects in the application, acting as them # through the browser, posting new activities, establishing new ties, etc. class Representation extend ActiveModel::Naming include ActionController::RecordIdentifier attr_reader :subject # Sets up new representation # # params[:subject] must contain the dom_id of the represented subject def initialize arg @subject = case arg when Hash arg[:subject_dom_id] =~ /(.*)_(\d*)$/ subject_type = $1.classify.constantize subject_id = $2.to_i subject_type.find subject_id else arg end end def subject_dom_id dom_id(subject) end # ActiveRecord compatibility def to_key #:nodoc: nil end end
Version data entries
12 entries across 12 versions & 1 rubygems