Sha256: b8cfc0780b03ab72c17a6c29e9ab39afe7575981fea7f59665d941b1e78b62f0

Contents?: true

Size: 1.3 KB

Versions: 24

Compression:

Stored size: 1.3 KB

Contents

require 'rails_connector/basic_obj'
require 'fiona7/shadow_classes'

module RailsConnector
  class BasicObj
    def scrivito_obj
      Scrivito::Obj.find(self.id)
    end

    has_many(:arel_permissions, :class_name => "::RailsConnector::Permission", :foreign_key => "object_id")
    # never use cached permissions
    def permissions
      arel_permissions
    end

    def self.in_place(type='Obj',&block)
      klass = ShadowClasses.fetch(self.name,type)
      klass.class_eval(&block)
      klass
    end

    def self.widget_class
      self.shadow_class
    end

    def self.model_class
      self.shadow_class
    end

    def self.shadow_class
      ShadowClasses.const_get(self.name, false)
    end

    def self.compute_type(type_name)
      if Fiona7.mode == :standalone
        fallback_class = self
      else
        fallback_class = ::Obj
      end
      try_type { type_name.constantize } || fallback_class
    end


    class << self

      def inherited(subclass,*args)
        super
        if subclass.name == 'Obj' && !::Scrivito.const_defined?('Obj', false)
          ::Scrivito.const_set('Obj', Class.new(::Scrivito::BasicObj))
        end
      end
    end

  end
end

module Reactor
  module Persistence
    module ClassMethods
      def sanitize_name(old_name)
        old_name
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.5 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.6.1.1.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.6.1.1.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.2.3 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.2.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.2.2 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.5.5.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.5.5.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.1.4 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.5.4.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.5.4.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.1.3 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.5.3.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.4.3.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.3.2.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.5.2.0.0 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.1.1 lib/fiona7/fiona_connector_patches/basic_obj.rb
infopark_fiona7-1.2.0.0.1 lib/fiona7/fiona_connector_patches/basic_obj.rb