Displaying 2 results from an estimated 2 matches for "time_entries_attribut".
Did you mean:
time_entries_attributes
2013 Mar 04
2
accepts_nested_attributes: undefined method 'association'_attributes
I have 2 models Timesheet and TimeEntry:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :time_entries_attributes
has_many :time_entries, dependent: :destroy
accepts_nested_attributes_for :time_entries, :reject_if => proc {
|attributes| attributes[''worktime''].blank? }
end
class TimeEntry < ActiveRecord::Base
attr_accessible :task_id, :timesheet_id, :workdate, :worktime
b...
2013 Mar 25
1
validates presence of foreign key fails in nested form
...ser_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible :task_id, :timesheet_id, :time_entries_attributes
validates :task_id, presence: true, uniqueness: { scope: ''timesheet_id''}
belongs_to :timesheet
belongs_to :task
has_many :time_entries, order: :workdate, dependent: :destroy
accepts_nested_attributes_for :time_entries, allow_destroy: true,
reject_if: proc { |a| a[:wo...