[Rails] 'Implicit' subselection of data in find?

Jeremy Nelson jem at apposite.com.au
Wed Apr 5 03:07:38 GMT 2006


Ok, to answer my own question, the magic words is 'scope' and it has 
been extensively discussed on this mailing list. Best article on the use 
of 'with_scope' seems to be:

http://habtm.com/articles/2006/02/22/nested-with_scope

Sorry for the noise! (I did look hard- honest!)

Thanks,
Jeremy.
>
> I'm writing a rails app that I'd like to use to service a number of 
> different websites out of the same running code base. So currently on 
> each request I have a before_filter that looks at the domain name, 
> looks up a table (called 'sites') and sets a global $site variable 
> which I can use in models, views and controllers to customise 
> behaviour (including localisation). So far so good.
> [...]
> I don't think the example I read was about different web sites running 
> out of the same code base. But it definitely tackled the same problem.
>
> Many thanks!
> Jeremy.



More information about the Rails mailing list