That would be in the controller not the model, wouldn't it?

Whilst I could do that I really want a different model, so I can 
implement different logic for InnerCity locations (eg increase the 
price, decrease the size, ... :-) ).

Sonia Hamilton.



Jonathan Clarke wrote:
> Something like this?
>
> @foo = InnerCity.find(:all, :conditions=>{:postcode=>[2001, 2002]})
>
> Jonathan
>
>
> 2009/8/14 Sonia Hamilton <[email protected]>:
>   
>> Hi guys, I've been lurking around the RORO list for a while. I don't
>> know whether it's appropriate to ask rails tech questions here, but I'll
>> post anyway and see what happens...
>>
>> My question is: if I subclass a model, how do I limit the records
>> retrieved in the subclass?
>>
>> eg I have:
>>     
>>> % gem list --local | egrep 'rails|activerecord'
>>> activerecord (1.15.3)
>>> rails (1.2.3)
>>>
>>> class Location < ActiveRecord::Base
>>>   # stuff
>>> end
>>>
>>> class InnerCity < Location
>>>   # additional stuff
>>> end
>>>       
>> In the InnerCity class, I only want to see the rows that would result
>> from a where clause of "postcode in (2000,2001)". How would I do this?
>>
>> I know about polymorphism and :polymorphic and :as (and that would be
>> the ideal solution). But I'm wondering is there's another way...
>>
>> Thanks,
>>
>> --
>> Sonia Hamilton.
>>
>>
>>
>>     
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" 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/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to