Module: XBar::AssociationCollection
- Defined in:
- lib/xbar/association_collection.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build_with_xbar(*args) ⇒ Object
- #count(*args) ⇒ Object
- #create_with_xbar(*args) ⇒ Object
- #create_with_xbar!(*args) ⇒ Object
- #ids_reader_with_xbar(*args) ⇒ Object
- #ids_writer_with_xbar(*args) ⇒ Object
- #reader_with_xbar(*args) ⇒ Object
- #should_wrap_the_connection? ⇒ Boolean
- #writer_with_xbar(*args) ⇒ Object
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/xbar/association_collection.rb', line 3 def self.included(base) if XBar.rails31? base.instance_eval do alias_method_chain :reader, :xbar alias_method_chain :writer, :xbar alias_method_chain :ids_reader, :xbar alias_method_chain :ids_writer, :xbar alias_method_chain :create, :xbar alias_method_chain :create!, :xbar alias_method_chain :build, :xbar end end end |
Instance Method Details
#build_with_xbar(*args) ⇒ Object
17 18 19 20 |
# File 'lib/xbar/association_collection.rb', line 17 def (*args) owner.reload_connection (*args) end |
#count(*args) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/xbar/association_collection.rb', line 56 def count(*args) if should_wrap_the_connection? XBar.using(@owner.current_shard) { super } else super end end |
#create_with_xbar(*args) ⇒ Object
42 43 44 45 |
# File 'lib/xbar/association_collection.rb', line 42 def (*args) owner.reload_connection (*args) end |
#create_with_xbar!(*args) ⇒ Object
47 48 49 50 |
# File 'lib/xbar/association_collection.rb', line 47 def (*args) owner.reload_connection (*args) end |
#ids_reader_with_xbar(*args) ⇒ Object
32 33 34 35 |
# File 'lib/xbar/association_collection.rb', line 32 def (*args) owner.reload_connection (*args) end |
#ids_writer_with_xbar(*args) ⇒ Object
37 38 39 40 |
# File 'lib/xbar/association_collection.rb', line 37 def (*args) owner.reload_connection (*args) end |
#reader_with_xbar(*args) ⇒ Object
22 23 24 25 |
# File 'lib/xbar/association_collection.rb', line 22 def (*args) owner.reload_connection (*args) end |
#should_wrap_the_connection? ⇒ Boolean
52 53 54 |
# File 'lib/xbar/association_collection.rb', line 52 def should_wrap_the_connection? @owner.respond_to?(:current_shard) && @owner.current_shard != nil end |
#writer_with_xbar(*args) ⇒ Object
27 28 29 30 |
# File 'lib/xbar/association_collection.rb', line 27 def (*args) owner.reload_connection (*args) end |