Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   Plain english to condition?? (http://www.velocityreviews.com/forums/t850143-plain-english-to-condition.html)

Varun Goel 05-07-2008 04:58 AM

Plain english to condition??
 
Hi All,
I wanna to do something like as:
1. Use will type plain English in text box like designation equals PM or
designation = PM.

2.Then i have to save this rule in DB and i have to made some function
to verify this rule.

3. My problem is that how to make if condition for following rule
dynamically.Cos in ROR i can say designation == 'PM'then fine but how i
will check that designation equals PM.

4.Means i have to make condition from plain english dynamically.

Please tell me ur suggestions.

Thanks
Varun
--
Posted via http://www.ruby-forum.com/.


Daniel Finnie 05-07-2008 03:51 PM

Re: Plain english to condition??
 
[Note: parts of this message were removed to make it a legal post.]

Why not have one input box on the right and one on the left with an equals
sign in the middle. Then you can so something like this:

left_box = "designation"
right_box = "PM"

model_instance.send(left_box) == right_box

Of course, be sure to sanitize your input. You don't want to call destroy!
or something on model_instance.

Dan

On 5/7/08, Varun Goel <varun.rajeshkumar@gmail.com> wrote:
>
> Hi All,
> I wanna to do something like as:
> 1. Use will type plain English in text box like designation equals PM or
> designation = PM.
>
> 2.Then i have to save this rule in DB and i have to made some function
> to verify this rule.
>
> 3. My problem is that how to make if condition for following rule
> dynamically.Cos in ROR i can say designation == 'PM'then fine but how i
> will check that designation equals PM.
>
> 4.Means i have to make condition from plain english dynamically.
>
> Please tell me ur suggestions.
>
> Thanks
> Varun
> --
> Posted via http://www.ruby-forum.com/.
>
>




All times are GMT. The time now is 01:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.