Class: ActiveRecord::Acts::List::WithConnection
- Inherits:
-
Object
- Object
- ActiveRecord::Acts::List::WithConnection
- Defined in:
- lib/acts_as_list/active_record/acts/with_connection.rb
Instance Attribute Summary collapse
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(recipient) ⇒ WithConnection
constructor
A new instance of WithConnection.
Constructor Details
#initialize(recipient) ⇒ WithConnection
Returns a new instance of WithConnection.
7 8 9 |
# File 'lib/acts_as_list/active_record/acts/with_connection.rb', line 7 def initialize(recipient) @recipient = recipient end |
Instance Attribute Details
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
11 12 13 |
# File 'lib/acts_as_list/active_record/acts/with_connection.rb', line 11 def recipient @recipient end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/acts_as_list/active_record/acts/with_connection.rb', line 13 def call if recipient.respond_to?(:with_connection) recipient.with_connection do |connection| yield connection end else yield recipient.connection end end |