I'm using Ruby on Rails 2.3.8. I have many user model objects stored in memory and many situations against which I want to see it. Because all this data is stored in memory, I want to avoid killing databases in order to execute these checks. There is a way to check these models without hitting the database, that is, there is a way to validate SQL where an in-memory model is against the object?
To make things more clear, if I was actually pulling records from the database, then I do something like this:
whereCondition = "name like 'James Smith '"User.find (: first, terms: & gt; [where condition]) I have many users and there are many circumstances available in memory, and what exactly do I Like this:
someUser.meetsCondition? (Where the situation) Which one boolean will return? Is there any way to do this without writing to my own SQL Parser?
Thanks
This is a way to do this without parsing itself is not.
However, if you want, you can create a slit in-memory database and load the record in it and then you can use your query. I do not know how this would be practical - this is definitely a lot of work to do on a normal web request, and the cost of doing this can only be more expensive than the query against your real database again anyway. You have to experiment.
Comments
Post a Comment