Module: PcQueues::ActsAsQueueOwner::ClassMethods
- Defined in:
- lib/pc_queues/acts_as_queue_owner.rb
Instance Method Summary collapse
Instance Method Details
#has_many_queues_as(symbol, options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/pc_queues/acts_as_queue_owner.rb', line 15 def has_many_queues_as(symbol, = {}) klass = [:class_name] or symbol.to_s.camelize.singularize # has_many symbol, options.merge(:as => :queue_owner, :dependent => :destroy, :conditions => {:type => klass}) has_many symbol, -> {where(type: klass)}, .merge(:as => :queue_owner, :dependent => :destroy) #==at :condtions is deprecated in rails 4, so replaced it with this end |
#has_one_queue_as(symbol, options = {}) ⇒ Object
21 22 23 24 25 |
# File 'lib/pc_queues/acts_as_queue_owner.rb', line 21 def has_one_queue_as(symbol, = {}) klass = [:class_name] or symbol.to_s.camelize.singularize has_one symbol, -> {where(type: klass)}, .merge(:as => :queue_owner, :dependent => :destroy) # has_one symbol, options.merge(:as => :queue_owner, :dependent => :destroy, :conditions => {:type => klass}) end |