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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I would recommend that you create a DSL for your users. You can setup a mapping that abstracts away your domain specific names and allows for various types of rule creation. You need to guard/filter against code injection if you are eval-ing the rules directly. Hope that helps. On Wed, May 7, 2008 at 12:59 AM, Varun Goel < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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/. > > > >-- James Mitchell --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Take a look at TreeTop. I''m not sure how complicated you want to get, but it might be what you are looking for. http://www.rubyinside.com/treetop-powerful-but-easy-ruby-parser-library-701.html HTH On May 6, 9:59 pm, Varun Goel <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---