I've finally found am elegant solution which solves both problems
using "has many, through":
----------------------------------------------------------------
class Node1 < ActiveRecord::Base
  has_many :edges
  has_many :node2s, :through => :edges
end

class Edge < ActiveRecord::Base
  belongs_to :node1
  belongs_to :node2
end

class Node2 < ActiveRecord::Base
  has_many :edges
  has_many :node1s, :through => :edges
end


class Node1sController < ApplicationController
  active_scaffold :Node1  do |config|
    config.columns = [:name, :node2s, :edges]
    #config.columns[:node2s].form_ui = :select

    config.list.columns.exclude [:edges]
    config.create.columns.exclude [:node2s]
    config.update.columns.exclude [:node2s]
  end
end

class EdgesController < ApplicationController
  active_scaffold :Edge  do |config|
    config.columns = [:node1, :rich_value, :node2]
  end
end

class Node2sController < ApplicationController
  active_scaffold :Node2  do |config|
    config.columns = [:node1s, :edges, :name]
    #config.columns[:node1s].form_ui = :select

    config.list.columns.exclude [:edges]
    config.create.columns.exclude [:node1s]
    config.update.columns.exclude [:node1s]
  end
end
----------------------------------------------------------------

Many thanks to Josh Susser (via his blog) for solving half of this.
http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off

On Sep 20, 7:43 pm, dschruth <[EMAIL PROTECTED]> wrote:
> I'm finding that
>
> "has_many X , :through"
>
> might work... and that terminology wise:
>
> my "Valued Edge List" ==  rails' "Rich Associations"
>
> for question/problem 2.
>
> But there is still the problem (question 1) of the potentially
> overwhelming amount of check boxes for HABTM & HM:T relationships.
> Does anybody know of a workaround?  some other way to display other
> than .form_ui = :select ?
>
> On Aug 13, 6:12 pm, dschruth <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Totally new to Ruby & Rails & Active Scaffold this week!  But I'm
> > cruising along pretty well.
>
> > Two important questions which I didn't have the patience to dig
> > through the forum to find answers for are:
>
> > 1) I'm able to get many to many tables working just fine both with the
> > full records of the other table and it's "create another" & "add
> > existing" default functionality  AND the checkboxes functionality
> > using "config.columns[:other_table].ui_type = :select"
>
> > My question is, can't I get something in-between these two extremes?
> > I don't like the way the default (show the whole record) version runs
> > way off the right side of the browser (when there are lots of fields)
> > and how there are big gaps between records when I'm using a "note"
> > text field.  The checkbox solution, is similarlly problematic when
> > there is lots of data.
>
> > Are more than just these two ways for the user interface to connect
> > many to many table records.
>
> > 2) I'm wondering if its possible to use a valued edgelist (sorry to
> > whip out my graph theory jargon on you: its basically just the
> > connector table with an additional column for a value which describes
> > the one of the many possible relationships between two many-to-many
> > related table records).  I haven't really tried just adding a new
> > column to my intermediate table yet but I'm guessing based on the only
> > two m2m outputs that I know of (described in #1 above) , it probably
> > wouldn't do anything automatically.
>
> > For example if I have a table called Reaction and another called
> > Analysis... but sometimes Analyses are carried out on a *mix* of two
> > reactions.  But I would like to keep track of the amount drawn from
> > each Reaction that are eventually mixed and Analyzed
>
> > So does anybody know if this is possible (without creating seperate
> > models and controllers for the intermediate M2M table?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to