Struggling with a couple of things.

10 views
Skip to first unread message

Nick Roosevelt

unread,
Dec 8, 2011, 2:06:19 AM12/8/11
to ActiveScaffold : Ruby on Rails plugin
AS is absolutely fantastic. However, I am struggling with a couple of
configuration issues.

1. I have teams, teams_users, and users. I want to be able to assign
users to teams by checking a checkbox on the team edit page or
something simple like that, without being able to add a user from any
of the teams pages. Is there an example of this kind of many-to-many
relationship and how to handle it in active_scaffold? Is it better to
do hmt or habtm? Am I actually including teams_users as a field, or
users?

2. I want to have access to the current user when determining the
contents of some select lists. Is this possible? can you point me to
some example?

Thank you very much for any info on these things.

Atastor

unread,
Dec 9, 2011, 7:12:05 AM12/9/11
to actives...@googlegroups.com
First let me ask: Do you really want a many-to-many relationship between teams and users?

Iff so, here are my suggestions:

to 1.: You already have
in teams
has_many :team_users
has_many :users, :through => :team_users, :readonly => false

reverse in users

and in users
has_many :team_users
has_many :teams, :through => :team_users, :readonly => false

? Then set in teams_controller:

conf.columns[:users].set_ui = :select
conf.columns[:users].options = {:draggable_lists => true}

to 2.:

Regards and Good Luck!
Michael

Reply all
Reply to author
Forward
0 new messages