Skip to content

Instantly share code, notes, and snippets.

@elsapet
Last active Aug 29, 2015
Embed
What would you like to do?
# in models/pet.rb
class Pet < ActiveRecord::Base
end
# in models/user.rb
class User < ActiveRecord::Base
has_one :pet
accepts_nested_attributes_for :pet
end
# in admin/user.rb
ActiveAdmin.register User do
permit_params :name, :age, pet_attributes: [:id, :name] # NB the id parameter..
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment