How to configure the fields for associations?

108 views
Skip to first unread message

Sid

unread,
Mar 17, 2012, 2:40:42 PM3/17/12
to rails...@googlegroups.com
Hi,

I just started using the RailsAdmin and wondering how could I configure the fields of association objects.

Say I have:

class Theater < ActiveRecord::Base
  has_and_belongs_to_many :movies
end

class Movie < ActiveRecord::Base
  has_and_belongs_to_many :theaters
end

On the Show page of movies, it show all the Movie fields plus the name of the Theater (theater.name). Then how could I customize the Theater's field that displays in the Movie's show page?

I thought I could try something like:

config.model Movie do
   ...
   ...
   show do
      field :title
      field: plot
      field: theaters do
        field :name
        field :class 
      end
   end
end

But turned out, it doesn't work this way. So any suggestions here would be appreciate.

Benoit Bénézech

unread,
Mar 18, 2012, 11:15:46 AM3/18/12
to rails...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages