Here''s something interesting, I''m trying to implement an
acts_as_customised plugin.
The central idea is that a user can customise another table, let''s
call it address_book for sake of example. They can edit which fields
they want, this information is stored in a third table, imaginatively
called ''fields'', which contains the SQL datatype, column name,
human
name, HTML display type and a few other display attributes. When a
field is added yet another table called user_#{id}
_address_book_fields is updated to contain the column. This is done
by Magic. This final table has an id column which is bound to the
primary key in address_book to keep things together.
I''m trying to figure out the best way to do this. I''m thinking
it
might be an idea to create a fake model for each user and use
method_missing to redirect anything not found by the base model on to
the second one. Is this a wise move? Is there some better way people
can think of? It almost seems like multiple table inheritance, I can
think of a couple of ways to implement that as well.
--
Phillip Hutchings
phillip.hutchings-QrR4M9swfipWk0Htik3J/w@public.gmane.org
Phillip, I think I''m working on exactly the same thing! This weekend I wrote a prototype plugin for what I''m calling acts_as_free_form. You can read my wiki page on the store.rb website and download the prototype at the bottom. If I am doing what you are trying to do I''d like to collaborate on this. http://trac.vaillant.ca/store.rb/wiki/DbModelVirtualFields Peter On 11/7/05, Phillip Hutchings <sitharus-rails-QrR4M9swfipWk0Htik3J/w@public.gmane.org> wrote:> > Here''s something interesting, I''m trying to implement an > acts_as_customised plugin. > > The central idea is that a user can customise another table, let''s > call it address_book for sake of example. They can edit which fields > they want, this information is stored in a third table, imaginatively > called ''fields'', which contains the SQL datatype, column name, human > name, HTML display type and a few other display attributes. When a > field is added yet another table called user_#{id} > _address_book_fields is updated to contain the column. This is done > by Magic. This final table has an id column which is bound to the > primary key in address_book to keep things together. > > I''m trying to figure out the best way to do this. I''m thinking it > might be an idea to create a fake model for each user and use > method_missing to redirect anything not found by the base model on to > the second one. Is this a wise move? Is there some better way people > can think of? It almost seems like multiple table inheritance, I can > think of a couple of ways to implement that as well. > -- > Phillip Hutchings > phillip.hutchings-QrR4M9swfipWk0Htik3J/w@public.gmane.org > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
i have a number of div''s on my site with "id_distributor_1" to "id_distributor_x" (x depends on the number of entries in the database). now i´d like to toggle these divs. with using element.toggle i have to know the id-names, which is not the case because i don´t know how many entries there are. any suggestions? _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Untested, but you could do something like this...
<script>
function toggleDisplay()
for (var x = 0; ; x++) {
if (var element =
document.getElementById(''id_distributor_'' + x)) {
element.style.display = ''none'';
} else {
return;
}
}
}
</script>
Warmest regards,
Nathan.
--------------------------------------------------------------
Nathaniel S. H. Brown Toll Free 1.877.4.INIMIT
Inimit Innovations Phone 604.724.6624
www.inimit.com Fax 604.444.9942
> -----Original Message-----
> From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On
Behalf Of patrick k
> Sent: November 7, 2005 2:27 PM
> To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Subject: [Rails] Element.toggle with multiple divs
>
> i have a number of div''s on my site with
"id_distributor_1"
> to "id_distributor_x" (x depends on the number of entries in
> the database).
> now i´d like to toggle these divs. with using element.toggle
> i have to know the id-names, which is not the case because i
> don´t know how many entries there are.
>
> any suggestions?
>