Sha256: d1086da71a5a95488aff1cb8d35803979e0474c1b64c1e2e575d66a5e9e1dd6e
Contents?: true
Size: 768 Bytes
Versions: 25
Compression:
Stored size: 768 Bytes
Contents
module CanTango module Rules module Dsl def self.included(base) ::CanTango.config.user.relations.each do |relationship| base.class_eval %{ def #{relationship}_of *models, &block options = models.extract_options! scope = options[:scope] || :user_account relation = UserRelation.new :#{relationship}, self, scope, *models, &block yield relation if block relation end } end end # creates a scope that enforces either using the user or user_account for determining relationship matches on the models def scope name, &block yield CanTango::Rules::Scope.new name, self, &block end end end end
Version data entries
25 entries across 25 versions & 2 rubygems