On Sun, Jul 22, 2012 at 2:13 PM, Matt Harrison <[email protected]> wrote:

> For example, lets say the dataset contains a list of furniture. Ids 1-10
> might be tables and 11-20 might be chairs.
>
> Lets say the other model defines a room. A room should be able to have
> one table and one chair. Unfortunately, as they both refer to the same
> model, I'm a loss on how to do it. Not even sure if it's possible, which
> will be a real pain as I can't modify the larget dataset at all.

class Furniture < ActiveRecord::Base; end

class Table < Furniture
   default_scope where(  ... check id here... )
end

class Chair < Furniture

-- 
Hassan Schroeder ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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 https://groups.google.com/groups/opt_out.


Reply via email to