# Plain english to condition?

**URL:** <https://www.ruby-forum.com/t/plain-english-to-condition/136895>\
**Category:** Ruby\
**Created:** [May 7, 2008, 6:58am UTC](https://www.ruby-forum.com/t/plain-english-to-condition/136895 "2008-05-07T06:58:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [May 7, 2008, 6:58am UTC](https://www.ruby-forum.com/t/plain-english-to-condition/136895/1 "2008-05-07T06:58:36Z")

</div>

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.

1. 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

---

<div class="post-metadata">

**Author:** ![varunkumargoel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/ed8c4c/32.png) [@varunkumargoel](https://www.ruby-forum.com/u/varunkumargoel)\
**Post date:** [May 7, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/plain-english-to-condition/136895/2 "2008-05-07T17:55:16Z")

</div>

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
