Last active
May 3, 2016 13:38
-
-
Save ericcf/f4da02ca5bb80d889131f603448ee10c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rails -v | |
Rails 4.2.6 | |
$ rails new nested_update | |
... | |
$ cd nested_update | |
$ echo "gem 'rails_admin', '~> 0.8.1'" >> Gemfile | |
$ bundle | |
... | |
$ rails g rails_admin:install | |
... | |
<enter> | |
... | |
$ rails g model person name | |
... | |
$ rails g model cat person:references name | |
... | |
$ rails g model dog person:references name | |
... | |
$ rake db:migrate | |
... | |
$ vi app/models/person.rb [see file below] | |
$ rails s | |
... | |
$ open http://localhost:3000/admin/person/new [in a new tab] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person < ActiveRecord::Base | |
has_one :cat | |
has_one :dog | |
accepts_nested_attributes_for :cat, update_only: true | |
accepts_nested_attributes_for :dog, update_only: false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment