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 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/3EbMQxRMf4gJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to