module Reactor::Attributes::ClassMethods

Public Instance Methods

__cms_attributes(obj_class) click to toggle source
# File lib/reactor/attributes.rb, line 441
def __cms_attributes(obj_class)
  obj_class_def = RailsConnector::Meta::EagerLoader.instance.obj_class(obj_class) #RailsConnector::ObjClass.where(:obj_class_name => obj_class).first
  obj_class_def ? obj_class_def.custom_attributes : {}
end
__mandatory_cms_attributes(obj_class) click to toggle source
# File lib/reactor/attributes.rb, line 446
def __mandatory_cms_attributes(obj_class)
  obj_class_def = RailsConnector::Meta::EagerLoader.instance.obj_class(obj_class) #RailsConnector::ObjClass.where(:obj_class_name => obj_class).first
  obj_class_def ? obj_class_def.mandatory_attribute_names(:only_custom_attributes => true) : []
end
inherited(subclass) click to toggle source
Calls superclass method
# File lib/reactor/attributes.rb, line 432
def inherited(subclass)
  super(subclass) # if you remove this line, y'll get TypeError: can't dup NilClass at some point

  # t2 = Time.now
  Reactor::AttributeHandlers.install_attributes(subclass)
  # Rails.logger.debug "Installing dynamic module for #{subclass.name} took #{Time.now - t2}"
  subclass
end
reload_attributes(new_obj_class=nil) click to toggle source
# File lib/reactor/attributes.rb, line 451
def reload_attributes(new_obj_class=nil)
  new_obj_class ||= self.name
  raise ArgumentError, "Cannot reload attributes because obj_class is unknown, provide one as a parameter" if new_obj_class.nil?

  RailsConnector::Meta::EagerLoader.instance.forget_obj_class(new_obj_class)
  Reactor::AttributeHandlers.reinstall_attributes(self, new_obj_class)
end