Philip Hallstrom wrote:
>> additional model. This child model would contain info on the  
>> apartments
>> belonging to a multi unit complex.  But searching by price range  
>> sounds
>> little messy in this case, with duplicate addresses resolving and
>> combing through apartments and child complex model for pricing
>>
>> Any suggestions are very welcome
> 
> Perhaps have an Apartment model that is the complex.  Then have a Unit
> model that has the details for that particular unit.  This creates a
> little annoyance when you have an apartment complex that has only one
> unit, but at least it's consistent.
> 
> As for search by price range... add a "min_price" and "max_price" to
> the Apartment model and then some after save handlers on the Unit
> model that would update those fields appropriately.  That way a search
> by price is done only the the Apartment model and should be very
> quick...
> 
> -philip

Thanks Philip. That sounds like a clear, good way to do it.  I initially 
thought of something like that. I strayed away because I already created 
a model for single house/condo rent and felt I'll be re-doing a lot of 
code if I do multi type separately.  But it really sounds like the right 
choice.

Cheers,
mrak
-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to