Skip to content

Commit

Permalink
chore(readme): fixed within section [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskorobicyn committed Oct 23, 2015
1 parent 4b8b0f3 commit 9dc8cf0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ Only works with class/scope methods. Connection changed until query is perfomed.
Connection will be switched only for required class.
```ruby
# simple usage
SomeModel.within(:slave) do
SomeModel.where(name: 'me')
end

# It also can be combined with "on" method

SomeModel.within(:mysql) do
me = SomeModel.find_by_name('me')
SomeModel.on(:slave).find_by_name('me').update_attributes(me.attributes)
end

# ACTUNG!!
Somemodel.within(:slave) do
#!!! Will be executed on default connection for OtherModel
# it can execute multi-models queries on other connection
ActiveRecord::Base.within(:slave) do
SomeModel.where(name: 'me').first
OtherModel.where(name: 'me').first
end
```
Expand Down

0 comments on commit 9dc8cf0

Please sign in to comment.