Re: [Rails] Validate uniqueness of association not working.

2015-09-12 Thread Colin Law
On 12 September 2015 at 05:00, Luis wrote: > >> Here is the code you ask Colin: > > > _form > > simple_form_for @pcp do |f| > = f.error_notification > > .form-inputs.row.col-md-12 > = f.input :name > = f.input :last > = f.input :phone1 > = f.input :phone2 > = f.input :bod

Re: [Rails] Validate uniqueness of association not working.

2015-09-11 Thread Luis
> Here is the code you ask Colin: _form simple_form_for @pcp do |f| = f.error_notification .form-inputs.row.col-md-12 = f.input :name = f.input :last = f.input :phone1 = f.input :phone2 = f.input :bod = f.input :esp =f.simple_fields_for :medhospitals do |ho

Re: [Rails] Validate uniqueness of association not working.

2015-09-11 Thread Colin Law
On 11 September 2015 at 16:43, Luis wrote: > Hi! > > I have the following classes for postgres rails 4 project : > > class Medhospital < ActiveRecord::Base > belongs_to :pcp > belongs_to :hospital > validates_uniqueness_of :pcp_id, :scope => :hospital_id > end > > class Pcp < ActiveRecord:

[Rails] Validate uniqueness of association not working.

2015-09-11 Thread Luis
Hi! I have the following classes for postgres rails 4 project : class Medhospital < ActiveRecord::Base belongs_to :pcp belongs_to :hospital validates_uniqueness_of :pcp_id, :scope => :hospital_id end class Pcp < ActiveRecord::Base has_many :scheds has_many :medhospitals, depende