I need to do a if field value = 1 then method but I cannot seem to find the right way /sytax for it. I have a rule table which contains a selector_id field. If set to 1 then do A else do B. No matter what type of syntax I try I cannot seem to get it working. Anyone that can help out?
on 2007-04-28 20:41
on 2007-04-28 20:46
NeoWip wrote: > > > > if (field_value == 1) do stuff else do different stuff end Make sure you use a double = when comparing values.
on 2007-04-28 21:03
I still get a NameError in RulesController#learnif The table name is rules, model name rule and the field is selector_id. Here is what I have if (selector_id == 1) @rules = 'test' else @rules = 'works' what am I doing wrong?
on 2007-04-28 23:36
got it t = Rule.find(1) if ( t.selector_id == 2) @rules = 'test' else @rules = 'works'