On Apr 26, 2014, at 18:10 , Jeremy Evans <[email protected]> wrote:
> On Saturday, April 26, 2014 4:50:03 PM UTC-7, Snarke wrote: > > First, you should make this a plugin. Okay, I'll look into that. > Second, avoid using class variables in ruby, they are almost always a bad > idea. What is my alternative? Each model *instance* needs to know its primary key, which it sounds like I'll be able to get for free if I switch to a plug-in, but the name of the table that's storing the properties is the same for all the instances. I could reconstruct it anew for each instance, but it seems like something that should be done once, for the class. > Well, the entity attribute value table (EAV) approach is a fairly common way > to represent the storage of arbitrary metadata for a related row in another > table. It works OK for simple things, but quickly becomes problematic if you > want more complex querying. That's this? Yea, I've already had to bypass the module for those times when I want "all the rooms that have brown countertops in their kitchen" or such. But that's exactly what I would have had to have done if I didn't have the module, so it didn't seem like a major issue. > If you only plan to support PostgreSQL, I would definitely switch to the > hstore approach. It will be faster, easier to query, and simpler to > implement. Part of me thinks I ought to be more generalized, but I know that, for myself, just about any database project that I do that might need this code, will have data that's important, and Postgres is the only open-source DB that I can trust with my data, so *I'm* never going to use MySQL or Sqlite or whatever. Of course, switching to hstore also eliminates the need for the class variables; another vote in its favor I guess. :) -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
