MetaSearch Gem-Rails 3.0 workspace methods don't work in Rails 3.2
Convenient MetaSearch functions like .not_in worked in Rails 3.0 and 3.1 inside scope calls.
I had to rewrite some of the scopes as "plain Rails 3.2" without the convenience of MetaSearch, although MetaSearch works out of scope. And I broke several of my apps and tools on updating.
Ideas? I use MetaSearch everywhere. I even wrote my own predicate. Something obvious may still be missing, I hope.
On Rails 3.2, running inside a code splitting engine. It doesn't seem to matter when I tried to isolate Vanilla-Rails without namespace / subfolders or engines.
Note. I wrote my first custom "Where" predicate: gt_da for: more_than_days_ago so: created_gt_da = 7 will look for created records> = 7.days.ago https://github.com/ernie/meta_search/wiki/Handy-way-to- develop-and-test-creating-a-new-% 22Where% 22-without-restarting-your-server-everytime
class Bug < ActiveRecord::Base
# MetaSearch
search_methods :bug_active
## Rails 3.0 (and gems of that time) => 100%), 3.1 pretty sure
## Rails 3.2 error: "undefined method `not_in' for :resolution:Symbol"
scope :bug_active, lambda {|checked|
where(:resolution.not_in => ['ERWITHPM','WONTFIX','WORKSFORME','DATAFIXDEPLOYED','PATCHDEPLOYED','RELEASEDEPLOYED','DUPLICATE','INVALID'] \
, :bug_status.not_in => ['VERIFIED'] ) }
## Rewritten to work in Rails 3.2 without MetaSearch convenience inside of scope
## ... a pinch more work which is why we love MetaSearch!
scope :bug_active_why, lambda {|checked|
where("resolution not in (?)", ['ERWITHPM','WONTFIX','WORKSFORME','DATAFIXDEPLOYED','PATCHDEPLOYED','RELEASEDEPLOYED','DUPLICATE','INVALID'])
.where("bug_status not in (?)", ['VERIFIED'] )
}
end
module Bugzilla
class BugsController < ApplicationController
@p = params[:search]
## MetaSearch works fine here on ":resolution_not_in" from form/search
@p[:resolution_not_in] = ['WONTFIX','WORKSFORME']
@search = Bug
.limit(50)
.where("version like '2012_%p'")
.search(@p)
end
end
source to share
No one has answered this question yet
See similar questions:
or similar: