Sha256: 8e15ce2453d1706f78ae4c8e296d86a9db10d51cc1c49de659fe94730ed38683
Contents?: true
Size: 995 Bytes
Versions: 24
Compression:
Stored size: 995 Bytes
Contents
class CamaleonCms::CustomFieldsRelationship < ActiveRecord::Base self.table_name = "#{PluginRoutes.static_system_info['db_prefix']}custom_fields_relationships" # attr_accessible :objectid, :custom_field_id, :term_order, :value, :object_class, # :custom_field_slug, :group_number default_scope { order("#{CamaleonCms::CustomFieldsRelationship.table_name}.term_order ASC") } # relations belongs_to :custom_fields, class_name: 'CamaleonCms::CustomField', foreign_key: :custom_field_id # validates :objectid, :custom_field_id, presence: true validates :custom_field_id, presence: true # error on clone model after_save :set_parent_slug after_save :update_model_owner # TODO: convert this model into polymorphic private def set_parent_slug # self.update_column('custom_field_slug', self.custom_fields.slug) end # touch owner model def update_model_owner "CamaleonCms::#{object_class}".constantize.find(objectid).touch rescue nil # owner model end end
Version data entries
24 entries across 24 versions & 2 rubygems