Ouch, I may have answered my own question. It can''t be done right now:
http://dev.rubyonrails.com/ticket/2025
:''(
A possible workaround might be to use views and rules, but I think
that would mean a lot of them (a view and model for each widget)
which would be icky for when widgets are added or deleted.
Phil
On Oct 14, 2005, at 4:00 PM, Philip Edelbrock wrote:
>
> I''m working on some schema for a new project that we''ll
be doing in
> rails (our first rails project!).
>
> A recurring structure we are seeing is the desire to define an
> ordering any way we wish, so ''acts_as_list'' comes to the
rescue.
> But, the ''position'' column seems to need to belong in the
join
> table to make sense.
>
> For example, we have lots of widgets listed in a
''widgets'' table.
> We have attributes that the widgets can have, so we have a join
> table between ''attributes'' and
''widgets'' (many to many). Now, we
> want to be able to order the widget attributes any way we wish /per
> widget/. That is, when you view a page which details the widget,
> it''s attributes are shown and are ordered in a particular way for
> that widget.
>
> Make sense? How would this work for my models in rails?
>
> Sample schema (in PostgreSQL):
>
> CREATE TABLE widgets (
> id serial,
> "position" int, -- for all widgets ordering
> name text,
> description text,
> etc.
> etc...);
>
> CREATE TABLE attributes (
> id serial,
> "position" int, -- for all attributes ordering
> name text,
> description text,
> etc.
> etc...);
>
> CREATE TABLE attributes_widgets (
> "position" int, -- for attributes per given widget ordering
> widget_id int references widgets (id),
> attribute_id int references attributes (id),
> etc.
> etc...
> );
>
>
> Phil
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>