aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller.rb
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-12-19 15:11:22 -0500
committerEileen Uchitelle <eileencodes@gmail.com>2018-12-21 11:10:10 -0500
commit22a1265828d9f743b8348fe53424fffb60d6d824 (patch)
treed47480ea6f007bd20e2441d16b25693974cc79f6 /actionpack/lib/abstract_controller.rb
parentabae9d0e0a0f1628cbf608765db09c1db3303732 (diff)
downloadrails-22a1265828d9f743b8348fe53424fffb60d6d824.tar.gz
rails-22a1265828d9f743b8348fe53424fffb60d6d824.tar.bz2
rails-22a1265828d9f743b8348fe53424fffb60d6d824.zip
Raise helpful error when role doesn't exist
If you try to call `connected_to` with a role that doesn't have an established connection you used to get an error that said: ``` >> ActiveRecord::Base.connected_to(role: :i_dont_exist) { Home.first } ActiveRecord::ConnectionNotEstablished Exception: No connection pool with 'primary' found. ``` This is confusing because the connection could be established but we spelled the role wrong. I've changed this to raise if the `role` used in `connected_to` doesn't have an associated handler. Users who encounter this should either check that the role is spelled correctly (writin -> writing), establish a connection to that role in the model with connects_to, or use the `database` keyword for the `role`. I think this will provide a less confusing error message for those starting out with multiple databases.
Diffstat (limited to 'actionpack/lib/abstract_controller.rb')
0 files changed, 0 insertions, 0 deletions