Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericlondon/rails4-has_many_through-accepts_nested_attributes_for-allow_destroy
Rails4 / has_many through / accepts_nested_attributes_for / allow_destroy / nested form
https://github.com/ericlondon/rails4-has_many_through-accepts_nested_attributes_for-allow_destroy
accepts-nested-attributes-for form has-many-through rails rails4 ruby
Last synced: about 1 month ago
JSON representation
Rails4 / has_many through / accepts_nested_attributes_for / allow_destroy / nested form
- Host: GitHub
- URL: https://github.com/ericlondon/rails4-has_many_through-accepts_nested_attributes_for-allow_destroy
- Owner: EricLondon
- Created: 2013-11-15T16:37:11.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T18:27:30.000Z (about 2 months ago)
- Last Synced: 2024-10-10T04:41:43.245Z (about 1 month ago)
- Topics: accepts-nested-attributes-for, form, has-many-through, rails, rails4, ruby
- Language: Ruby
- Size: 43 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Rails4 / has_many through / accepts_nested_attributes_for / allow_destroy / nested form
=======================================================================================Models:
```ruby
class Car < ActiveRecord::Basehas_many :garages
has_many :houses, through: :garagesaccepts_nested_attributes_for :garages, allow_destroy: true
end
``````ruby
class Garage < ActiveRecord::Basebelongs_to :car
belongs_to :houseaccepts_nested_attributes_for :house
end
``````ruby
class House < ActiveRecord::Basehas_many :garages
has_many :cars, through: :garagesend
```Nested form here:
- http://localhost:3000/cars/1/edit
- https://github.com/EricLondon/Rails4-has_many_through-accepts_nested_attributes_for-allow_destroy/blob/master/rails4/app/views/cars/_form.html.erb