Skip to content

EricLondon/Rails4-has_many_through-accepts_nested_attributes_for-allow_destroy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rails4 / has_many through / accepts_nested_attributes_for / allow_destroy / nested form

Models:

class Car < ActiveRecord::Base

  has_many :garages
  has_many :houses, through: :garages

  accepts_nested_attributes_for :garages, allow_destroy: true

end
class Garage < ActiveRecord::Base

  belongs_to :car
  belongs_to :house

  accepts_nested_attributes_for :house

end
class House < ActiveRecord::Base

  has_many :garages
  has_many :cars, through: :garages

end

Nested form here:

About

Rails4 / has_many through / accepts_nested_attributes_for / allow_destroy / nested form

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published