Method: OneTouch::ActiveRecordExtension::ClassMethods#as_favor_host
- Defined in:
- lib/one_touch/models/active_record_extension.rb
#as_favor_host(opt = {}) ⇒ Object
Used in host class Ex:
as_favor_host :bridge_klass => "AClass"
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/one_touch/models/active_record_extension.rb', line 79 def as_favor_host(opt={}) include ::OneTouch::PortBuild opt.reverse_merge!(bridge_klass: "Favor", no_default_relations: false, portname: :host) append_relation(opt) # assign_cattr_in_favor_class(:host_klasses,opt) # Programmer Doc # The Name of has_many is stick to favors, to make it changable would cause some query problem # :as => :host can not be configured too, cause in act_as_favor the relation name was sticked unless opt[:no_default_relations] has_many :favors, :class_name => opt[:bridge_klass], :as => :host end include AsFavorHost end |