More deprecation warnings

How can I fix the following code for deprecation warning?

def correct_client_assignment
role = Role.find_by_name(‘eclient’)
if client_id.blank? && role_id ==
errors.add :client_id, “must assign an external client to this
elsif !client_id.blank? && role_id !=
errors.add :client_id, “cannot assign an internal user to a

It is the errors.add part that is triggering the following messages:

…DEPRECATION WARNING: Errors#on have been
deprecated, use Errors#[] instead.
Also note that the behaviour of Errors#[] has changed. Errors#[] now
always returns an Array. An empty Array is returned when there are no
errors on the specified attribute. (called from on at



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs