Module: Promiscuous::Publisher::Model::Mongoid::ClassMethods
- Defined in:
- lib/promiscuous/publisher/model/mongoid.rb
Class Method Summary collapse
-
.publish_on(method, options = {}) ⇒ Object
TODO DRY this up with the publisher side.
Instance Method Summary collapse
Class Method Details
.publish_on(method, options = {}) ⇒ Object
TODO DRY this up with the publisher side
45 46 47 48 49 50 51 52 53 |
# File 'lib/promiscuous/publisher/model/mongoid.rb', line 45 def self.publish_on(method, ={}) define_method(method) do |name, *args, &block| super(name, *args, &block) if self.in_publish_block? name = args.last[:as] if args.last.is_a?(Hash) && args.last[:as] publish(name) end end end |
Instance Method Details
#get_operation_class_for(operation) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/promiscuous/publisher/model/mongoid.rb', line 63 def get_operation_class_for(operation) if operation == :create Moped::PromiscuousCollectionWrapper::PromiscuousCollectionOperation else Moped::PromiscuousQueryWrapper::PromiscuousQueryOperation end end |
#promiscuous_collection_name ⇒ Object
59 60 61 |
# File 'lib/promiscuous/publisher/model/mongoid.rb', line 59 def promiscuous_collection_name self.collection.name end |