Accepts_nested_attributes_for is not working for uniqueness

class User < ActiveRecord::Base
accepts_nested_attributes_for :emails, :allow_destroy => true,
:reject_if => proc { |attributes| attributes[‘address’].blank? }
end

class Email < ActiveRecord::Base
belongs_to :user
validates_presence_of :address
validates_email_format_of :address
validates_uniqueness_of :address, :scope=>‘user_id’
end

when i am saving multiple same emails at one time it is saving , but it
should not

Please suggest what i am missing

Thanks
Rajeev sharma

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