Displaying 20 results from an estimated 29 matches for "find_opt".
Did you mean:
find_opts
2007 Feb 28
5
How to use find_options in multi_search
...s is the id of the customer. For each multi_search I
want to do a give the id of the current customer as a parameter. This
should only return results for the given customer.
My current code looks like this:
Folder.multi_search(@search_query, [Myfile])
I noticed in the API you can add options and find_options to this. How
do I use these parameters, so only results for a certain customer are
returned?
Thanks in advance.
Mischa
--
http://boxroom.rubyforge.org
--
Posted via http://www.ruby-forum.com/.
2006 Oct 02
6
Strange Sorting Issues
Hi there,
I''m having some strange sorting stuff goign on. Here''s my search method:
sort_fields = []
sort_fields << Ferret::Search::SortField.new("name",
:reverse => :false)
@results = Listing.find_by_contents @search_criteria, :limit => :all,
:sort => sort_fields
page = (params[:page] ||= 1).to_i
items_per_page = 9
offset = (page - 1) *
2007 Jan 15
3
Wrong total_hits when using conditions in find_by_contents
...uld expect.
-----------------------------
Fix for this:
1) In the acts_as_ferret plugin, find the file class_methods.rb
2) Go to line 276 where you have this code-block
[code]if results.any?
conditions = combine_conditions([ "#{table_name}.#{primary_key} in
(?)", results.keys ],
find_options[:conditions])
result = self.find(:all,
find_options.merge(:conditions => conditions))
end[/code]
and add this line:
[code]if results.any?
conditions = combine_conditions([ "#{table_name}.#{primary_key} in
(?)", results.keys ],
find_options[:conditions])
result = se...
2009 Jul 06
0
[PATCH server] UI for accumulated uptime for VMs. (revised2)
...urces_controller.rb
index 9d1074a..87f07f5 100644
--- a/src/app/controllers/resources_controller.rb
+++ b/src/app/controllers/resources_controller.rb
@@ -63,7 +63,9 @@ class ResourcesController < PoolController
def vms_json
svc_show(params[:id])
- super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)
+ super(:full_items => @pool.vms,
+ :find_opts => {:select => Vm.calc_uptime},
+ :include_pool => :true)
end
def delete
diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_control...
2009 Jul 02
1
[PATCH server] UI for accumulated uptime for VMs. (revised)
...urces_controller.rb
index 9d1074a..87f07f5 100644
--- a/src/app/controllers/resources_controller.rb
+++ b/src/app/controllers/resources_controller.rb
@@ -63,7 +63,9 @@ class ResourcesController < PoolController
def vms_json
svc_show(params[:id])
- super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)
+ super(:full_items => @pool.vms,
+ :find_opts => {:select => Vm.calc_uptime},
+ :include_pool => :true)
end
def delete
diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_control...
2006 Aug 17
1
find_by_contents fails with :include option
find_by_contents will fail if you specify :include in the find_options
parameter. The problem is on line 313:
313: conditions = [ "id in (?)", id_array ]
314: # combine our conditions with those given by user, if any
315: if find_options[:conditions]
316: cust_opts = find_options[:conditions].dup
317: conditions.first << " and " &l...
2009 Jul 06
2
[PATCH server] UI for accumulated uptime for VMs. (revised3)
...urces_controller.rb
index 9d1074a..87f07f5 100644
--- a/src/app/controllers/resources_controller.rb
+++ b/src/app/controllers/resources_controller.rb
@@ -63,7 +63,9 @@ class ResourcesController < PoolController
def vms_json
svc_show(params[:id])
- super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)
+ super(:full_items => @pool.vms,
+ :find_opts => {:select => Vm.calc_uptime},
+ :include_pool => :true)
end
def delete
diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_control...
2009 Jun 29
3
[PATCH server] UI for accumulated uptime for VMs.
...rces_controller.rb
index 9d1074a..7188db8 100644
--- a/src/app/controllers/resources_controller.rb
+++ b/src/app/controllers/resources_controller.rb
@@ -63,7 +63,12 @@ class ResourcesController < PoolController
def vms_json
svc_show(params[:id])
- super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)
+ super(:full_items => @pool.vms, :find_opts => {:select => "*, case
+ when state='running' then
+ (cast(total_uptime || ' sec' as interval) +
+ (now() - total_uptime_timestamp))
+ else cast(to...
2006 Aug 25
7
acts_as_ferret with conditions
Hello guys,
Having a slight problem with acts_as_ferret, specifically using a
condition. I have the following code
@results = SupplierProduct.find_by_contents(params
[:search], :conditions => [''area_id = ?'', @area])
and it seems the condition isn''t being applied. Does anyone have any
pointers?
Cheers,
Alastair
------
Alastair Moore
Standards compliant web
2006 Oct 21
2
find_by_content result set
Hi Guys
I''m experiencing with AAF and Ferret with the intention of deploying
into the site that I am working on now.
So I setup AAF to index 3 fields that I have in this model and i tried
doing a find_by_contents and it returned the
#<FerretMixin::Acts::ARFerret::SearchResults:0xb74b5bec
@total_hits=1157, @results=[#<Payprofile:0xb74cc39c
@attributes={"add......
but it
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
...> {:username => {:store => :yes, :boost =>
30}, :subject => {:store => :yes, :boost => 20}, :body => {:store =>
:yes, :boost => 10}}, :remote => true }, { :analyzer =>
Ferret::Analysis::RegExpAnalyzer.new(/./, false) })
def self.full_text_search(q, options = {}, find_options = {})
return nil if q.nil? or q==""
default_options = {:limit => 10, :page => 1}
options = default_options.merge options
# get the offset based on what page we''re on
options[:offset] = options[:limit] * (options.delete(:page).to_i-1)
# now do the que...
2007 Jul 18
5
Strange search result with conditions in find_by_contents
...ll_text_search(params[:searchTerms], :page
=> (params[:page]||1))
@total, @topics = Topic.full_text_search(params[:searchTerms], {:page =>
(params[:page]||1)}, {:conditions => @conditions})
@pages = pages_for(@total)
end
end
end
in my model Topic:
def self.full_text_search(q, options = {}, find_options = {})
return nil if q.nil? or q==""
default_options = {:limit => 10, :page => 1}
options = default_options.merge options
# get the offset based on what page we''re on
options[:offset] = options[:limit] * (options.delete(:page).to_i-1)
# now do the que...
2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around
filter. I have defined expectations on the model classes, and ideally, I
would add a further expectation for the scope. Is this already possible
in some way? How would I go about adding support a scope expectation?
Michael
--
Michael Schuerig
mailto:michael at schuerig.de
http://www.schuerig.de/michael/
2006 Jun 02
2
pass extra value through text_field_with_auto_complete?
Hi,
I''m wondering if it is possible to pass an extra value (which I will
use to further restrict my query) using text_field_with_auto_complete?
Any suggestions would be appreciated!
-Mike
2006 Aug 01
0
Custom Autocomplete Field - Making a field lowercase
...The other idea is to create a rhtml template that generates the
auto_complete_return.. but I have no idea how to do that.
Here''s the code:
View:
<%= text_field_with_auto_complete :post_code, :locality, :cols => 40 %>
Controller:
def auto_complete_for_post_code_locality
find_options = {
:conditions => [ "LOWER(locality) LIKE ?",
params[:post_code][:locality].downcase + ''%'' ],
:order => "locality ASC",
:limit => 10 }
@items = PostCode.find(:all, find_options)
render :inline =&...
2007 Dec 13
4
please explain find_with_ferret, retrieve_records, :include and :conditions
Hello, I''m using find_with_ferret to search multiple models and it
works great. The trouble is I need to filter the results
using :include and :conditions.
I get two errors depending on the syntax I use in the search. Reading
the source, I see the retrieve_records method seems to filter
the :include and :conditions so that they only apply to the relevant
model when searching
2007 Sep 28
4
undefined method error
Hi,
I''m running the trunk version with drb server. In my ferret_server.log I
get a lot of messages like this:
#method_missing(:add, ["User", {:first_name=>"blah", :comments=>nil,
:company=>"blah", :phone_day=>""}])
Over and over again.
But more importantly, since yesterday doing a search has caused an
exception:
A NoMethodError
2006 Dec 28
13
Sorting/Ordering Search Results
...(http://www.ruby-forum.com/topic/62993#66934)
where the issue was claimed to be resolved - so I figure I''m doing
something wrong - but I just can''t figure it out. Any help anyone can
give would be appreciated. Thanks!
Member.rb (model)
def self.full_text_search(q, options = {}, find_options = {})
return nil if q.nil? or q == ""
default_options = {:limit => 10, :page => 1}
options = default_options.merge options
options[:offset] = options[:limit] * (options.delete(:page).to_i-1)
results = Member.find_by_contents(q, options, find_options)
return [result...
2018 Nov 30
1
[PATCH] Replace -nodefconfig with -no-user-config.
...lysis/boot-analysis-timeline.c b/utils/boot-analysis/boot-analysis-timeline.c
index 3ff031487..4b7da31fa 100644
--- a/utils/boot-analysis/boot-analysis-timeline.c
+++ b/utils/boot-analysis/boot-analysis-timeline.c
@@ -195,7 +195,7 @@ construct_timeline (void)
/* Find where we run qemu. */
FIND_OPTIONAL ("qemu", LONG_ACTIVITY,
data->events[j].source == GUESTFS_EVENT_APPLIANCE &&
- strstr (data->events[j].message, "-nodefconfig"),
+ strstr (data->events[j].message, "-no-user-config"),...
2009 May 22
1
[PATCH server] fixed smart pool 'save' regression.
...ces_controller.rb b/src/app/controllers/resources_controller.rb
index efd3cb6..9d1074a 100644
--- a/src/app/controllers/resources_controller.rb
+++ b/src/app/controllers/resources_controller.rb
@@ -66,12 +66,6 @@ class ResourcesController < PoolController
super(:full_items => @pool.vms, :find_opts => {}, :include_pool => :true)
end
- def additional_create_params
- {:parent_id => (params[:hardware_pool] ?
- params[:hardware_pool][:parent_id] :
- params[:parent_id])}
- end
-
def delete
vm_pool_ids = params[:vm_pool_ids].split(&q...