From tom.smidt at gmail.com Wed Nov 1 13:54:05 2006 From: tom.smidt at gmail.com (Tom Smidt) Date: Wed, 1 Nov 2006 11:54:05 -0700 Subject: [Boulder-Denver Ruby Group] Ruby/Rails project - need Message-ID: Hello, I've got a project where we need a Ruby developer to build out screen functionality and work directly with the client and other team members. You can work virtually but I'd like to meet and discuss your qualifications, availability and rate first. You will be contracting to iCita ( www.icita.net) a Boulder/Longmont based company for a client that is located in downtown Denver. You may be required to meet with them a few times in Denver. Qualifications: - Strong background in Ruby and Rails development - Ability to problem solve and understand complex concepts - PHP, MySQL and Linux experience - Self-starter and productive You will be jumping into this project mid-stream with a well-known organization in Denver with high visibility. I don't require a formal resume at this time, but do want your qualifications, years of experience, availability and will check references and previous projects. Participation may lead to more projects as we are growing. Please respond directly to Tom Smidt at iCita at tom.smidt at icita.net. You may forward this email but please do not place on other job lists. No recruiters or third-party companies at this time please. Thank you. - Tom Smidt iCita Inc. http://www.icita.net 877.711.9091 ext. 803 tom.smidt at icita.net (email preferred) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/bdrg-members/attachments/20061101/e220da0b/attachment.html From kevincbw at qwest.net Wed Nov 1 16:15:45 2006 From: kevincbw at qwest.net (Kevin Williams) Date: Wed, 01 Nov 2006 14:15:45 -0700 Subject: [Boulder-Denver Ruby Group] Ara's lightning talk at RubyConf Message-ID: <45490E81.8010107@qwest.net> Hello Ara, I saw your lightning talk at RubyConf; nice job! Did you build your distributed environment on DRb or Rinda? Thanks. -- Kevin From ara.t.howard at noaa.gov Thu Nov 2 10:09:19 2006 From: ara.t.howard at noaa.gov (ara.t.howard at noaa.gov) Date: Thu, 2 Nov 2006 08:09:19 -0700 (MST) Subject: [Boulder-Denver Ruby Group] Ara's lightning talk at RubyConf In-Reply-To: <45490E81.8010107@qwest.net> References: <45490E81.8010107@qwest.net> Message-ID: On Wed, 1 Nov 2006, Kevin Williams wrote: > Hello Ara, hi kevin- > I saw your lightning talk at RubyConf; nice job! Did you build your > distributed environment on DRb or Rinda? believe it or not, neither! it's 100% nfs based. although that may seem like an odd choice it buys a bunch of features - no (new) ports need opened. nfs is about the only thing that can get through our firewalls so this makes us able to install and configure clusters with zero admin intervention. - nfs has the nice property that it hangs (on the client) when the server goes down rather than dropping the connection. just last week we rebooted our central server and it took about 1.5 days to come back up (fsck on giant disks) and all the jobs on 30 nodes simply froze until it was fully functional again. - typically one needs a central code location that's shared anyhow: we install all code and configuration on this central nfs server so and upgrade of ruby, for instance, is instantly available on all nodes. our nodes have nothing but a user account and a crontab, which lets us bring them online from scratch in literally minutes: there is no software installed locally. - the nfs model is more easily understood by less technical operators since it's operation is an abstraction of the filesystem and that is well understood by any operator you can read more about it, (slightly) out-dated, here http://www.linuxjournal.com/article/7922 fyi - i'm just about to release a new version. if you are planning on playing with rq let me know and i'll send you a pre-release. cheers. -a -- my religion is very simple. my religion is kindness. -- the dalai lama From pjones at pmade.org Fri Nov 3 11:57:55 2006 From: pjones at pmade.org (Peter Jones) Date: Fri, 3 Nov 2006 09:57:55 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> Message-ID: I've released my subversion automation tool, and it's in the gem list: gem install svnauto --include-dependencies I've also put together a 10 minute screencast of SC in action. If you're interested, take a look at: http://pmade.com/ On Oct 30, 2006, at 08:24, Peter Jones wrote: > I'm getting ready to release some code I wrote for automating > Subversion branching and merging and was hoping that some of you > would be willing to check it out and kick the tires a bit. -p -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/bdrg-members/attachments/20061103/b16c4e05/attachment.html From tim.pease at gmail.com Fri Nov 3 13:03:31 2006 From: tim.pease at gmail.com (Tim Pease) Date: Fri, 3 Nov 2006 11:03:31 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> Message-ID: <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> On 10/30/06, ara.t.howard at noaa.gov wrote: > > yay to all those that release code into the wild! > If you would like a more friendly format for your Test::Unit output, require this file when you run your tests ... http://www.zippy6.net/ruby/plib/test_unit_reporter.rb This bit of code will change your output from > ruby test/my_suite.rb .......E.....F........ To something more like this > ruby -r test_unit_reporter test/my_suite.rb TestAPC::TestPDU test_class_connect PASS test_connect PASS test_connected_eh PASS test_debug PASS test_debug_equals FAIL ./test/test_pdu.rb:53:in `test_debug_equals' is not true. test_disconnect PASS test_goto_menu PASS test_outlet_cmd PASS test_outlet_status PASS test_outlets PASS test_reboot PASS test_separator PASS test_separator_equals PASS test_turn_off PASS test_turn_on PASS ============================================================================== pass: 14, fail: 1, error: 0 total: 15 tests with 64 assertions in 0.12 seconds ============================================================================== If you have the "facets" gem installed, everything will have nice pretty colors, too (if your terminal supports ANSI color codes). Enjoy TwP From pjones at pmade.org Sat Nov 4 13:25:55 2006 From: pjones at pmade.org (Peter Jones) Date: Sat, 4 Nov 2006 11:25:55 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> Message-ID: <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> On Nov 03, 2006, at 11:03, Tim Pease wrote: > If you would like a more friendly format for your Test::Unit output, > require this file when you run your tests ... > > http://www.zippy6.net/ruby/plib/test_unit_reporter.rb Tim, is this your code? If so, do you have any plans to release it as a gem? -p From tim.pease at gmail.com Mon Nov 6 10:47:05 2006 From: tim.pease at gmail.com (Tim Pease) Date: Mon, 6 Nov 2006 08:47:05 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> Message-ID: <69f66b790611060747k1740c41fj77f77ba1a75a6948@mail.gmail.com> On 11/4/06, Peter Jones wrote: > On Nov 03, 2006, at 11:03, Tim Pease wrote: > > If you would like a more friendly format for your Test::Unit output, > > require this file when you run your tests ... > > > > http://www.zippy6.net/ruby/plib/test_unit_reporter.rb > > Tim, is this your code? If so, do you have any plans to release it > as a gem? > Yah, it's my code. Making it into a gem would be easy, but I don't know if it would be worthwhile. Does a single file warrant a gem? Thoughts? TwP From doug.fales at gmail.com Mon Nov 6 11:21:07 2006 From: doug.fales at gmail.com (Doug Fales) Date: Mon, 6 Nov 2006 09:21:07 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> Message-ID: <22185b1f0611060821s3dc52ebew853de2754dd961@mail.gmail.com> Tim, This is great stuff! I'd love to see it as a gem and/or a rails plugin! Thanks for sharing it. -Doug On 11/3/06, Tim Pease wrote: > On 10/30/06, ara.t.howard at noaa.gov wrote: > > > > yay to all those that release code into the wild! > > > > If you would like a more friendly format for your Test::Unit output, > require this file when you run your tests ... > > http://www.zippy6.net/ruby/plib/test_unit_reporter.rb > > This bit of code will change your output from > > > ruby test/my_suite.rb > .......E.....F........ > > To something more like this > > > ruby -r test_unit_reporter test/my_suite.rb > TestAPC::TestPDU > test_class_connect PASS > test_connect PASS > test_connected_eh PASS > test_debug PASS > test_debug_equals FAIL > ./test/test_pdu.rb:53:in `test_debug_equals' > is not true. > test_disconnect PASS > test_goto_menu PASS > test_outlet_cmd PASS > test_outlet_status PASS > test_outlets PASS > test_reboot PASS > test_separator PASS > test_separator_equals PASS > test_turn_off PASS > test_turn_on PASS > ============================================================================== > pass: 14, fail: 1, error: 0 > total: 15 tests with 64 assertions in 0.12 seconds > ============================================================================== > > > If you have the "facets" gem installed, everything will have nice > pretty colors, too (if your terminal supports ANSI color codes). > > Enjoy > > TwP > _______________________________________________ > Bdrg-members mailing list > Bdrg-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/bdrg-members > From mgarriss at gmail.com Mon Nov 6 13:36:30 2006 From: mgarriss at gmail.com (Michael Garriss) Date: Mon, 6 Nov 2006 11:36:30 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <69f66b790611060747k1740c41fj77f77ba1a75a6948@mail.gmail.com> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> <69f66b790611060747k1740c41fj77f77ba1a75a6948@mail.gmail.com> Message-ID: On Nov 6, 2006, at 8:47 AM, Tim Pease wrote: > On 11/4/06, Peter Jones wrote: >> On Nov 03, 2006, at 11:03, Tim Pease wrote: >>> If you would like a more friendly format for your Test::Unit output, >>> require this file when you run your tests ... >>> >>> http://www.zippy6.net/ruby/plib/test_unit_reporter.rb >> >> Tim, is this your code? If so, do you have any plans to release it >> as a gem? >> > > Yah, it's my code. Making it into a gem would be easy, but I don't > know if it would be worthwhile. Does a single file warrant a gem? yes it does. there are many examples of this in my gem list. and i don't need to explain the benefit of the gem system. nice work btw. -mike From mghaught at gmail.com Tue Nov 7 00:04:01 2006 From: mghaught at gmail.com (Marty Haught) Date: Mon, 6 Nov 2006 22:04:01 -0700 Subject: [Boulder-Denver Ruby Group] November Ruby Meeting Update Message-ID: <57f29e620611062104s6ba850f4ifed0f51879d4ae72@mail.gmail.com> Hi Guys, I wanted to update everyone on our meeting next Wednesday. Originally, Marcel Molina was going to fly into Denver a bit early to present at our meeting. Unfortunately, he just let me know he's over-committed and needed to back out. This leaves us with no scheduled presentations for next week. Anyone out there willing to present with a week's notice? In other news, due to sufficient prodding, Tim Pease has agreed to join me in organizing the group. We've been discussing what to do with the November meeting and Tim has suggested doing a 'lightning round' of talks. A lightning talk, for those of you no familiar with this concept, is a short talk, usually 5 minutes in length. We don't quite need to be so short if you want more like 10-15 minutes. I think this idea is a good ones for those of you who might want to present a short topic but don't feel comfortable with a full hour's worth of material. So I encourage you to think about what you might like to talk about and bring your laptop with whatever you need to do your mini-talk. If you don't have a lightning talk per se, let me give you a more specific idea. Mind you, it doesn't have to follow this format but if you're not already inspired here's another idea -- Rails Show and Tell. I'd like any of you who are doing something interesting or different in Rails to show that off. The premise would be that many of us in the room might learn some aspect of Rails we didn't already know as well as it might start up a short conversation on it. So don't feel you have to be the authority on whatever it is your presenting. You could also think of these as Rails Recipes too. In summary, my hope is that we'll still have something interesting to talk with so we don't sit around and stare at me and think how lame the gathering is. :) Please email me off list if you would like to do a lightning talk or a full presentation. We still have plenty of slots for upcoming months so if you want to volunteer for a talk later on, that's cool too. Cheers, Marty From tim.pease at gmail.com Thu Nov 9 14:40:32 2006 From: tim.pease at gmail.com (Tim Pease) Date: Thu, 9 Nov 2006 12:40:32 -0700 Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question Message-ID: <69f66b790611091140s31c39c42sbb8af9146d3be47@mail.gmail.com> This is a little long, but please bear with the explanation. I want to be able to setup a database table that can hold different kinds of "stuff" where each type of "stuff" can have vastly different contents (or attributes). For example, one type of stuff would be information about a person -- name, age, address, hair color, etc. Another type of stuff would be a book -- title, author, ISBN. I would like to store all these things in one table so that I can have a join table linking a user to their "stuff". The join table would have user specific attributes about the stuff (description, tags, etc). The "stuff" table would only have one copy of each "stuff" item. Some SQL ... CREATE TABLE stuff ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, type VARCHAR(50) NOT NULL, name TEXT NOT NULL, description TEXT NULL ); CREATE TABLE stuff_attributes ( stuff_id INT NOT NULL, name VARCHAR(45) NOT NULL, value TEXT NOT NULL ); The idea here is that each "type" of stuff gets stored in the stuff table with the type attribute set to what it is ('person' or 'book'). The attributes about that stuff are then stored in the stuff_attributes table, with each attribute being a separate entry with the "name" of the attribute and the "value" for the attribute. For a book, then, there would a single entry in the stuff table describing the thing's type as a "book", the book's name and a description. The stuff_attributes table would have three entries -- the title attribute and its value, the author attribute and its value, and the ISBN attribute and its value. Obviously there will need to be an SQL join when doing any query to get information about particular stuff. Does ActiveRecord make this dead simple? Or will I end up rewriting most of the ActiveRecord methods to make this kind of table schema work? More general, is there a better way of doing this kind of generic data about stuff in ActiveRecord? Any helpful pointers are appreciated. Actual working Rails code with attached database schema will get you a free beer on Wednesday night ;) Blessings, TwP From charlie.knoll at gmail.com Thu Nov 9 15:39:39 2006 From: charlie.knoll at gmail.com (Charlie Knoll) Date: Thu, 9 Nov 2006 13:39:39 -0700 Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question In-Reply-To: <69f66b790611091140s31c39c42sbb8af9146d3be47@mail.gmail.com> References: <69f66b790611091140s31c39c42sbb8af9146d3be47@mail.gmail.com> Message-ID: I've never done it, but my first idea would be to wrap up the master-detail "transformation" in the master objects CRUD methods and use the "has_many :children" and "belongs_to :parent" functionality. One concern is that you lose a lot of the power of using indexes to optimize your queries when implementing this type of database model. It may not matter in your case... On 11/9/06, Tim Pease wrote: > > This is a little long, but please bear with the explanation. > > I want to be able to setup a database table that can hold different > kinds of "stuff" where each type of "stuff" can have vastly different > contents (or attributes). For example, one type of stuff would be > information about a person -- name, age, address, hair color, etc. > Another type of stuff would be a book -- title, author, ISBN. > > I would like to store all these things in one table so that I can have > a join table linking a user to their "stuff". The join table would > have user specific attributes about the stuff (description, tags, > etc). The "stuff" table would only have one copy of each "stuff" > item. > > Some SQL ... > > CREATE TABLE stuff ( > id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, > type VARCHAR(50) NOT NULL, > name TEXT NOT NULL, > description TEXT NULL > ); > > CREATE TABLE stuff_attributes ( > stuff_id INT NOT NULL, > name VARCHAR(45) NOT NULL, > value TEXT NOT NULL > ); > > > The idea here is that each "type" of stuff gets stored in the stuff > table with the type attribute set to what it is ('person' or 'book'). > The attributes about that stuff are then stored in the > stuff_attributes table, with each attribute being a separate entry > with the "name" of the attribute and the "value" for the attribute. > > For a book, then, there would a single entry in the stuff table > describing the thing's type as a "book", the book's name and a > description. The stuff_attributes table would have three entries -- > the title attribute and its value, the author attribute and its value, > and the ISBN attribute and its value. > > Obviously there will need to be an SQL join when doing any query to > get information about particular stuff. > > Does ActiveRecord make this dead simple? Or will I end up rewriting > most of the ActiveRecord methods to make this kind of table schema > work? > > More general, is there a better way of doing this kind of generic data > about stuff in ActiveRecord? > > Any helpful pointers are appreciated. Actual working Rails code with > attached database schema will get you a free beer on Wednesday night > ;) > > Blessings, > TwP > _______________________________________________ > Bdrg-members mailing list > Bdrg-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/bdrg-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/bdrg-members/attachments/20061109/0a9ced9d/attachment.html From bwg1974 at yahoo.com Thu Nov 9 17:29:31 2006 From: bwg1974 at yahoo.com (Brian Gibson) Date: Thu, 9 Nov 2006 14:29:31 -0800 (PST) Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question Message-ID: <20061109222931.65126.qmail@web54506.mail.yahoo.com> You should consider Polymorphic Associations or Single Table Inheritence to accomplish this. STI is probably closer to your "one-table" for all "stuff" requirement but if your different kinds of stuff" have vastly different attributes your table of "stuff" will be very wide. Polymorphic Associations on the other hand will allow you to create an association from one class to multiple classes. http://wiki.rubyonrails.org/rails/pages/SingleTableInheritance http://wiki.rubyonrails.com/rails/pages/PolymorphicAssociations ----- Original Message ---- From: Tim Pease To: bdrg-members at rubyforge.org Sent: Thursday, November 9, 2006 12:40:32 PM Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question This is a little long, but please bear with the explanation. I want to be able to setup a database table that can hold different kinds of "stuff" where each type of "stuff" can have vastly different contents (or attributes). For example, one type of stuff would be information about a person -- name, age, address, hair color, etc. Another type of stuff would be a book -- title, author, ISBN. I would like to store all these things in one table so that I can have a join table linking a user to their "stuff". The join table would have user specific attributes about the stuff (description, tags, etc). The "stuff" table would only have one copy of each "stuff" item. Some SQL ... CREATE TABLE stuff ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, type VARCHAR(50) NOT NULL, name TEXT NOT NULL, description TEXT NULL ); CREATE TABLE stuff_attributes ( stuff_id INT NOT NULL, name VARCHAR(45) NOT NULL, value TEXT NOT NULL ); The idea here is that each "type" of stuff gets stored in the stuff table with the type attribute set to what it is ('person' or 'book'). The attributes about that stuff are then stored in the stuff_attributes table, with each attribute being a separate entry with the "name" of the attribute and the "value" for the attribute. For a book, then, there would a single entry in the stuff table describing the thing's type as a "book", the book's name and a description. The stuff_attributes table would have three entries -- the title attribute and its value, the author attribute and its value, and the ISBN attribute and its value. Obviously there will need to be an SQL join when doing any query to get information about particular stuff. Does ActiveRecord make this dead simple? Or will I end up rewriting most of the ActiveRecord methods to make this kind of table schema work? More general, is there a better way of doing this kind of generic data about stuff in ActiveRecord? Any helpful pointers are appreciated. Actual working Rails code with attached database schema will get you a free beer on Wednesday night ;) Blessings, TwP _______________________________________________ Bdrg-members mailing list Bdrg-members at rubyforge.org http://rubyforge.org/mailman/listinfo/bdrg-members From bwg1974 at yahoo.com Thu Nov 9 19:10:24 2006 From: bwg1974 at yahoo.com (Brian Gibson) Date: Thu, 9 Nov 2006 16:10:24 -0800 (PST) Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question Message-ID: <20061110001024.49641.qmail@web54501.mail.yahoo.com> Here's some pseudo-code which implements a polymorphic version of the example you listed in your original email. Note the intentional use of "collectible" (noun) versus "collectable" (adjective). I thought it made more sense instead of using "stuff", "stuffs", and "stuffable". The actual usage should help put the class definitions into focus. The Collectible object can have attributes and associations of its own, for example, created_on or has_many :tags. class User has_many :collectibles class Collectible belongs_to :collectable, :polymorphic => true belongs_to :user class Person has_many :collectibles, :as => :collectable class Book has_many :collectibles, :as => :collectable stuff = User.find(id).collectibles details = stuff.collect { |widget| widget.collectable # returns a collectable object (i.e. Person or Book) } # details should now be an array of people and books that belong to User.find(id) ----- Original Message ---- From: Tim Pease To: Brian Gibson Sent: Thursday, November 9, 2006 4:07:19 PM Subject: Re: [Boulder-Denver Ruby Group] Rails ActiveRecord Question On 11/9/06, Brian Gibson wrote: > You should consider Polymorphic Associations or Single Table Inheritence to accomplish this. > > STI is probably closer to your "one-table" for all "stuff" requirement but if your different kinds of stuff" have vastly different attributes your table of "stuff" will be very wide. > STI is very much what I'm looking for, just without the single table ;) It can / will get very wide as new "stuff" types are added. I'd much rather use two tables and have them treated as a single object (i'm some kind of "stuff" object, but you can find all my details over there in this other table). I'll have to dig through the STI code and see if any ideas pop out at me. > Polymorphic Associations on the other hand will allow you to create an association from one class to multiple classes. > Thanks for the links on both of these. It'll take a me a little while to wrap my head around Polymorphic Associations. I don't think it quite fits my desires, though. Blessings, TwP From bwg1974 at yahoo.com Thu Nov 9 19:10:24 2006 From: bwg1974 at yahoo.com (Brian Gibson) Date: Thu, 9 Nov 2006 16:10:24 -0800 (PST) Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question Message-ID: <20061110001024.49641.qmail@web54501.mail.yahoo.com> Here's some pseudo-code which implements a polymorphic version of the example you listed in your original email. Note the intentional use of "collectible" (noun) versus "collectable" (adjective). I thought it made more sense instead of using "stuff", "stuffs", and "stuffable". The actual usage should help put the class definitions into focus. The Collectible object can have attributes and associations of its own, for example, created_on or has_many :tags. class User has_many :collectibles class Collectible belongs_to :collectable, :polymorphic => true belongs_to :user class Person has_many :collectibles, :as => :collectable class Book has_many :collectibles, :as => :collectable stuff = User.find(id).collectibles details = stuff.collect { |widget| widget.collectable # returns a collectable object (i.e. Person or Book) } # details should now be an array of people and books that belong to User.find(id) ----- Original Message ---- From: Tim Pease To: Brian Gibson Sent: Thursday, November 9, 2006 4:07:19 PM Subject: Re: [Boulder-Denver Ruby Group] Rails ActiveRecord Question On 11/9/06, Brian Gibson wrote: > You should consider Polymorphic Associations or Single Table Inheritence to accomplish this. > > STI is probably closer to your "one-table" for all "stuff" requirement but if your different kinds of stuff" have vastly different attributes your table of "stuff" will be very wide. > STI is very much what I'm looking for, just without the single table ;) It can / will get very wide as new "stuff" types are added. I'd much rather use two tables and have them treated as a single object (i'm some kind of "stuff" object, but you can find all my details over there in this other table). I'll have to dig through the STI code and see if any ideas pop out at me. > Polymorphic Associations on the other hand will allow you to create an association from one class to multiple classes. > Thanks for the links on both of these. It'll take a me a little while to wrap my head around Polymorphic Associations. I don't think it quite fits my desires, though. Blessings, TwP From inboulder at gmail.com Thu Nov 9 19:35:47 2006 From: inboulder at gmail.com (Kyle) Date: Thu, 9 Nov 2006 17:35:47 -0700 Subject: [Boulder-Denver Ruby Group] Rails DB Con timeout Message-ID: <170321190611091635q2790c8bdg5b356bca7fdd4212@mail.gmail.com> Hi, I'm new to rails and put together my first rails app at http://69.55.233.76/journal . I'm experiencing a bit of a problem though in that if nobody hits the app for a few hours the DB connection times out. Does anyone have experience fixing this? I've read about this problem online and updated everything rails, gems, etc. The behavior manifests as 'Application Error (rails)' if nobody has accessed the app for awhile, but then starts working again on a browser refresh. (before updating rails it timed out indefinitely) I'm using the latest MySQL, Rails, Ruby ver, running on Fedora core 4. The behavior is the same on mongrel and Webrick Any ideas? (I supposed I could have a cron job hit the app every hour, but this is ghetto) Cheers, Kyle From wbruce at gmail.com Fri Nov 10 12:15:10 2006 From: wbruce at gmail.com (Bruce Williams) Date: Fri, 10 Nov 2006 10:15:10 -0700 Subject: [Boulder-Denver Ruby Group] Rails DB Con timeout In-Reply-To: <170321190611091635q2790c8bdg5b356bca7fdd4212@mail.gmail.com> References: <170321190611091635q2790c8bdg5b356bca7fdd4212@mail.gmail.com> Message-ID: <4896b9210611100915j73bd7d3ci9e7b92a3fead4674@mail.gmail.com> On 11/9/06, Kyle wrote: > Hi, > I'm new to rails and put together my first rails app at > http://69.55.233.76/journal . > I'm experiencing a bit of a problem though in that if nobody hits the > app for a few hours the DB connection times out. Does anyone have > experience fixing this? I've read about this problem online and > updated everything rails, gems, etc. The behavior manifests as > 'Application Error (rails)' if nobody has accessed the app for awhile, > but then starts working again on a browser refresh. (before updating > rails it timed out indefinitely) > I'm using the latest MySQL, Rails, Ruby ver, running on Fedora core 4. > The behavior is the same on mongrel and Webrick > Kyle, Maybe take a look at http://dev.rubyonrails.org/ticket/428; it's an old ticket, but there are some links and recommended courses of action there (especially if you're using FastCGI for some reason);. It may be as easy as a my.cnf change. Hope that helps. Cheers, Bruce From clements at colorado.edu Fri Nov 10 16:29:45 2006 From: clements at colorado.edu (David Clements) Date: Fri, 10 Nov 2006 14:29:45 -0700 Subject: [Boulder-Denver Ruby Group] Rails ActiveRecord Question In-Reply-To: <69f66b790611091140s31c39c42sbb8af9146d3be47@mail.gmail.com> References: <69f66b790611091140s31c39c42sbb8af9146d3be47@mail.gmail.com> Message-ID: On 11/9/06, Tim Pease wrote: > This is a little long, but please bear with the explanation. > > I want to be able to setup a database table that can hold different > kinds of "stuff" where each type of "stuff" can have vastly different > contents (or attributes). For example, one type of stuff would be > information about a person -- name, age, address, hair color, etc. > Another type of stuff would be a book -- title, author, ISBN. > > I would like to store all these things in one table so that I can have > a join table linking a user to their "stuff". The join table would > have user specific attributes about the stuff (description, tags, > etc). The "stuff" table would only have one copy of each "stuff" > item. > > Some SQL ... > > CREATE TABLE stuff ( > id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, > type VARCHAR(50) NOT NULL, > name TEXT NOT NULL, > description TEXT NULL > ); > > CREATE TABLE stuff_attributes ( > stuff_id INT NOT NULL, > name VARCHAR(45) NOT NULL, > value TEXT NOT NULL > ); > > > The idea here is that each "type" of stuff gets stored in the stuff > table with the type attribute set to what it is ('person' or 'book'). > The attributes about that stuff are then stored in the > stuff_attributes table, with each attribute being a separate entry > with the "name" of the attribute and the "value" for the attribute. > > For a book, then, there would a single entry in the stuff table > describing the thing's type as a "book", the book's name and a > description. The stuff_attributes table would have three entries -- > the title attribute and its value, the author attribute and its value, > and the ISBN attribute and its value. > > Obviously there will need to be an SQL join when doing any query to > get information about particular stuff. > > Does ActiveRecord make this dead simple? Or will I end up rewriting > most of the ActiveRecord methods to make this kind of table schema > work? > > More general, is there a better way of doing this kind of generic data > about stuff in ActiveRecord? > > Any helpful pointers are appreciated. Actual working Rails code with > attached database schema will get you a free beer on Wednesday night > ;) > > Blessings, > TwP > _______________________________________________ > Bdrg-members mailing list > Bdrg-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/bdrg-members > Hey Tim, If I am following you correctly I have a solution in production that we are using. The domain for my problem was that we kept on adding new preferences to our Users and Customers. I didn't want to change the schema for the Users tables or the Customers table each time we needed one of these new attributes. Luckily I have caught Ara's Metaprogramming Madness and created some code to help me with this problem. I created a Preferences table with at name, value and type. I employed STI and created a UserPreferences model. Now in my Users model I am able to declare the preferences that a User has with something like this: class User < ActiveRecord::Base include HasManyPreferences has_many_preferences :email_type => "html", :alternate_email_address => nil, :sectors => nil end What HasManyPreferences does this: 1) Creates the has_many relationship to user_preferences 2) Adds methods for the singular preferences so that you can do user.email_type = 'plain_text' 3) Adds accessor types methods for the plural prefernces so that you can user.add_sector("Tech") or user.delete_sector 2 and 3 in turn manage the has many relationship under the hood. For our use case these are all user driven ops so I don't know how it would scale. Let me know if you want to see the HasManyPreferences code. Dave From mghaught at gmail.com Fri Nov 10 16:41:15 2006 From: mghaught at gmail.com (Marty Haught) Date: Fri, 10 Nov 2006 14:41:15 -0700 Subject: [Boulder-Denver Ruby Group] Boulder-Denver Ruby Group - November 15th Message-ID: <57f29e620611101341w304c7818na9bee102059a5297@mail.gmail.com> Hi Everyone, I'm going to send the reminder on next week's meeting a bit earlier than my typical three day notice. The Boulder-Denver Ruby Group will be meeting on Wednesday, November 15th at 6:30pm (directions below). Doug Fales will lead off our meeting with a talk on plugins in Rails. For our second half of the meeting we'll be conducting a series of lightning talks. I've already gotten several responses from some of you on talks you'd like to do. Let me go over some thoughts on how I think we'll run this part. Though in true Ruby fashion we will be dynamic about conducting the talks so we can override the current implementation at runtime. :) Normally a lightning talk is pretty short, such as 5 minutes. If your talk is this short, great. If you need a bit more time that's cool too though they should be 15 minutes or less (If it's more you should consider doing a full length talk at one of our future meetings). I'd also like to have some time after the talk for questions/discussion on the subject. We do have plenty of openings remaining for anyone who hasn't emailed me yet. If we get too many talks and run out of time, we can continue another round of lightning talks next meeting if there's enough interest. I'm looking forward to the these shorter talks. It's great to hear what many of you are up to. Finally, I will give out another pair of Ruby books compliments of O'Reilly. I look forward to seeing you all there. Cheers, Marty Directions: Collective Intellect 1414 Pearl St., Suite 200 Boulder, CO 80302 It is located on the East end of the walking mall above a store called "Baby Doll" on the South side. The Collective Intellect name is on the door of a stairway leading up to the office. URL to google maps: http://rubyurl.com/QO7 From tim.pease at gmail.com Fri Nov 10 18:23:59 2006 From: tim.pease at gmail.com (Tim Pease) Date: Fri, 10 Nov 2006 16:23:59 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> Message-ID: <69f66b790611101523g3d509d31ib162b906c1e8e071@mail.gmail.com> On 11/4/06, Peter Jones wrote: > On Nov 03, 2006, at 11:03, Tim Pease wrote: > > If you would like a more friendly format for your Test::Unit output, > > require this file when you run your tests ... > > > > http://www.zippy6.net/ruby/plib/test_unit_reporter.rb > > Tim, is this your code? If so, do you have any plans to release it > as a gem? > So, I finally threw the test_unit_reporter into a gem and released it out on RubyForge gem install -r turn require 'turn' # at the top of your test file(s) "turn" is a stupid acronym for "Test::Unit Reporter (New)" TwP From pjones at pmade.org Fri Nov 10 19:31:43 2006 From: pjones at pmade.org (Peter Jones) Date: Fri, 10 Nov 2006 17:31:43 -0700 Subject: [Boulder-Denver Ruby Group] Subversion Automation In-Reply-To: <69f66b790611101523g3d509d31ib162b906c1e8e071@mail.gmail.com> References: <5B784D2D-732D-4128-AF4C-0E3ACCB27F64@pmade.org> <69f66b790611031003w1c961877i83bab3fd3ddffea4@mail.gmail.com> <87A44026-34F8-4848-8B56-8ACA802FA473@pmade.org> <69f66b790611101523g3d509d31ib162b906c1e8e071@mail.gmail.com> Message-ID: <8BBBF506-5AC6-4D42-98C7-CAEC1F9AFE34@pmade.org> On Nov 10, 2006, at 16:23, Tim Pease wrote: > So, I finally threw the test_unit_reporter into a gem and released it > out on RubyForge Supercool! -p -p From tony at clickcaster.com Fri Nov 17 20:14:07 2006 From: tony at clickcaster.com (Tony Arcieri) Date: Fri, 17 Nov 2006 18:14:07 -0700 Subject: [Boulder-Denver Ruby Group] Working with Rails Message-ID: http://workingwithrails.com Dunno how many of you have seen that or not, but I thought it might interest some people on this list. -- Tony Arcieri ClickCaster, Inc. tony at clickcaster.com (970) 232-4208 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/bdrg-members/attachments/20061117/c0f8ce6f/attachment.html