ruby on rails - Constricting find conditions based upon runtime contexts -


Wow Crazy Title! But here's the problem. In an effort to dry up the application of my school's website management system, I have created a module of my application and placed it in one place. The first fileset was used in the general website system, and there was also a child in the field of learning. They used to behave in exactly the same way, in addition to a subtle difference in the children's area, the fileset file was divided into two categories, startup, and general. The startup files are created by those teachers, the common people who have done the children now in the general website app, this distinction is not relevant and therefore it has been ignored. Here's a tough part I want to use the same controller and ideas in both contexts. At runtime I know that a fileset is in the field of learning either on the general site, so I can say that if it is in the context of learning area, then I want to stop FileSet.find (x). Files are only 'Normal' designated scope, if reference is a normal website, then we will not only use a nominated scope at all.

I have simplified the information given above, but basically the question is how can I tell FileSet.find.) Files and file system can be quite smart so that the runtime context Can you remove results based?

I have discovered a little bit of association expansion, but it does not seem to work. I hope there is something here. I am trying hard to keep this argument in the model and it does not have related ideas or controllers. I

Cheers,

Brendan

Can you use the named area with that present which is current Determines context and returns to the appropriate circumstances? Something like this in the file:

  named_scope: for_context ,: conditions = & gt; Lambda {if only_other? {: Type = & gt; 'Normal'} ALSO ONLY start? {: Type = & gt; 'General'} and {} End}  

Then you can call:

  FileSet.find (x) .files.for_context  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -