forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Belongs to association
bbenezech edited this page Nov 29, 2011
·
4 revisions
Synopsys:
class Player < ActiveRecord::Base
belongs_to :team, :inverse_of => :players
# if you want a dropdown select: (natural choice for a belongs_to association)
attr_accessible :team_id
# or for nested fields:
attr_accessible :team_attributes
accepts_nested_attributes_for :team, :allow_destroy => true
end
# for info
class Team < ActiveRecord::Base
has_many :players, :inverse_of => :team
end
RailsAdmin.config |config| do
config.model Player do
configure :team do
# configuration here
end
end
end