Re: [Rails] validates presence of foreign key fails in nested form

2013-03-25 Thread Serguei Cambour
Found the way to do that by using 'inverse_of' option (see below): On 25 Mar 2013, at 16:03, Javix wrote: > I'm using accepts_nested_attributes as follows: > > class Timesheet < ActiveRecord::Base > attr_accessible :status, :user_id, :start_date, :end_date, > :activities_attributes > has_m

[Rails] validates presence of foreign key fails in nested form

2013-03-25 Thread Javix
I'm using accepts_nested_attributes as follows: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :start_date, :end_date, :activities_attributes has_many :activities, dependent: :destroy has_many :time_entries, through: :activities accepts_nested_attributes_for :acti