Re: [Rails] Re: DRY a named scope

2010-07-22 Thread Bente Pieck
named_scope :has_valid_sysoid, lambda{|sysoid| conditions = ["nodesysoid IS NOT NULL AND nodelabel LIKE '%-to-%'] unless sysoid.nil? conditions[0]<< " AND nodesysoid = ?" conditions << sysoid end {:conditions => conditions, :include => [:ipinterface, :alarm]} } > Thanks. > > Tryi

[Rails] Re: DRY a named scope

2010-06-24 Thread Me
Thanks. Trying to keep the controller simple: Takes a value or not. One thing I could do was put he include inside the method call but where does the param go? Node.has_valid_sysoid(..) The scope is working, just trying cut out the duplication. On Jun 24, 5:57 pm, Philip Hallstrom wrote: > On