Sean Rudford
unread,Sep 27, 2011, 1:17:40 AM9/27/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rails_admin
I'm continuing to have issues with habtm relationships and what
attributes I need to give access to. It shows up in rails_admin as
read only. I think this is a simple thing that I'm missing. I've
tried adding :partner, :partner_id(s).
So if I just need to whitelist something or add another something to
the attr_accessible.
Here's my current set up:
Models
##########################
class Partner < ActiveRecord::Base
attr_accessible :name, :one_percent, :b_corp_member, :level, :type, :start_date, :end_date, :region, :logo, :description, :abstract
[...]
has_and_belongs_to_many :events
end
class Events < ActiveRecord::Base
attr_accessible :title, :when, :description, :college_id, :partners
[...]
has_and_belongs_to_many :partners
end
##########################
Rails admin config
##########################
config.model Event do
field :partners, :has_and_belongs_to_many_association
field :college, :belongs_to_association
field :title, :string
field :when, :datetime
field :description, :text do
ckeditor true
end
end
config.model Partner do
field :address, :has_one_association
field :states, :has_and_belongs_to_many_association
field :events, :has_and_belongs_to_many_association
field :name, :string
field :logo, :paperclip_file
field :abstract, :text do
ckeditor true
end
field :description, :text do
ckeditor true
end
field :one_percent, :boolean
field :b_corp_member, :boolean
field :level, :string
field :start_date, :date
field :end_date, :date
field :region, :string
end
##########################
Also, guys, thanks for making this. The more I get into it, the more
I appreciate all the flexibility you've built into it.