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 == role.id
      errors.add :client_id, "must assign an external client to this
user"
    elsif !client_id.blank? && role_id != role.id
      errors.add :client_id, "cannot assign an internal user to a
client"
    end
  end

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
/home/bruparel/.rvm/gems/ruby-1.9.2-p0/gems/activemodel-3.0.0.rc2/lib/active_model/deprecated_error_methods.rb:7)

Thanks.

Bharat
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to