Craig White wrote: > yes, you misunderstood... sorry if I wasn't clear enough. Something like > this, definitely not tested and perhaps you can get it down to a single > query. > > Class Pricing > has_one :customer > belongs_to :item > > id > price > customer_id > > def self.item_price(item, customer) > if Price.find(:first, :conditions => ["item_id = ? AND customer_id > = ?", item, customer']) then > return Price.find(:first, :conditions => ["item_id = ? AND > customer_id = ?", item, customer']).price > else > return Price.find(:first, :conditions => ["item_id = ? AND > customer_id = NULL", item]).price > end > end > > Craig > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.
AH! Okay - I think I got it. So you would just remove the price field from the item table altogether and just put it in its own table. Any tips or resources on the best way on how to do this? Still a bit of a rails newbie. Thanks! -Tony -- Posted via http://www.ruby-forum.com/. -- 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

