Hi everyone, I have a working named_scope here, however it's too cluttered. Anyone got a better (more efficient) and concise alternative?
Thanks. ============================================ named_scope :filter, lambda { |*args| if args.first && args.second == nil {} # return all records if args.first.blank? { :conditions => ["status = ?", args.second] } if args.second.blank? { :conditions => ["invoice_number= ?", args.first] } else { :conditions => ["nvoice_number= ? and status = ?", args.first, args.second] } end end end } -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.