Sha256: 89b433d1aff53e2d9f72389b9eea7726bac040d78a86e6403790010b5fcc898d
Contents?: true
Size: 653 Bytes
Versions: 1
Compression:
Stored size: 653 Bytes
Contents
class ActiveRecord::Base def self.acts_as_zone(params = {}) EpomRails.config.zone[:model] = self acts_as(Epom::Zone, params) override_belongs_to_zone end def self.override_belongs_to_zone site_association = EpomRails.config.zone[:belongs_to].find{|a| a[:epom_element]=="Site"} if site_association # overriding belongs_to: site define_method site_association[:name] do fields = EpomRails.config.zone[:fields] object = super() if object.respond_to?(fields.key('id')) and object.send(fields.key('id')) # here, retrieve this site from Epom end object end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
epom_rails-1.3.2 | lib/epom_rails/acts_as_zone.rb |