I am using rails_admin 0.6.5
with Rails 4.1.6
and have a has_many
/ belongs_to
association setup between the Volume and Issue models respectively:
class Volume < ActiveRecord::Base
has_many :issues, :inverse_of => :volume
validates :number, presence: true, numericality: {greater_than_or_equal_to: 1}
end
and the Issue model:
class Issue < ActiveRecord::Base
belongs_to :volume, :inverse_of => :issues
validates :number, presence: true, numericality: {greater_than_or_equal_to: 1}
validates :date, presence: true
end
Within the rails_admin
interface, it works but when creating or editing an Issue, the Volume drop-down menu is populated with the text Volume #1
, Volume #2
, Volume #3
(each as a separate option). Those "volume numbers" correspond to :volume_id
, not the Volume's :number
field, which is different than the ID and therefore confusing to users.
When creating or editing an Issue, how do I control which Volume column is displayed in the belongs_to
association drop-down menu? Thank you in advance for any help provided.