Displaying 20 results from an estimated 6000 matches similar to: "Questions regarding complex searching"
2006 Apr 22
4
Slice and dice plugin
I''ve been playing around with some easier ways of specifying
conditions in active record, and have come up with a little plugin
that some may find useful. Currently active record finder and
calculations methods can take a :conditions option with a string or
array listing some sql conditions, eg:
Animals.find :first, :conditions => "name = ''Tiger''"
My
2006 Jan 31
11
ez_where plugin updated features.
Friends-
I wanted to let people know that there is a new experimental release
of this plugin. I would love feedback on syntax and features. There
is now a full test suite with fixtures that covers all the available
syntax. Look at the test suite for more syntax possibilities. There
have been many additions since my last release. Fabien Atelier has
been working on this with me and has
2006 Feb 19
8
building multiple find conditions
I am trying to allow for AND type ''find'' but to allow for simply a
single set of find criteria.
controller code...
@vw_string = @vw_string1 = @vw_string2 = @vw_string3 = []
if params[:beg_intake_date] != "" then
@vw_string1 = ["intake_date between ? and ?",
params[:beg_intake_date], params[:end_intake_date] ]
end
if
2006 Jun 30
3
New release of ez-where plugin
Hello friends-
There is a new release of the ez-where plugin. This plugin makes it
easy to do complex ActiveRecord queries without writing any SQL. Ruby
operators are mapped to SQL operators like so:
foo == ''bar'' #=> ["foo = ?", ''bar'']
foo =~ ''%bar'' #=> ["foo LIKE ?", ''%bar'']
2006 Aug 19
3
Special ruby language for describing sql conditions
I was brainstorming today about a smooth way to define conditions in an
sql query, when the numbers of attributes increase, so does the uglyness.
So instead of passing a hash, I thought you could specify the conditions
directly in code.
I hacked together some example code which actually turned out to work.
The result is concise and pretty beutiful.
def search(params)
Ad.find(:all) do
2007 Jul 27
1
MRTG with 14all.cgi on centos 5
Hi,
I have setup MRTG with 14all.cgi cgi script.
I downloaded it from below URL.
http://my14all.sourceforge.net/14all-1.1.txt
and did only below 3 changes to that file. those can be seen in BOLDletters.
# if MRTG_lib.pm (from mrtg) is not in the module search path (@INC)
# uncomment the following line and change the path appropriatly:
#use lib qw(/usr/local/mrtg-2/lib/mrtg2);
use lib
2007 Apr 03
2
Coding for contrasts in unbalanced designs
Dear list members,
I want to use a GLM with an unbalanced factor and continuous variables.
My factor F has 12 unbalanced levels:
2006 Feb 23
13
Check if a saved user''s name is admin
Hi all,
I have a question about this method in my User model:
# Returns true for the (saved) user called "admin"
def is_the_administrator
true if save and name == "admin"
end
The method returns true if the user''s name is admin. However, I only want to
return true if the state of the object is "saved", so I call the save method
first.
I''m
2006 Jul 18
5
a best way to write this.
I have a form, with 3 fields, then in my controller I get the paramters
to run a query but I don''t want to filter with paramters if they are
nil or blank...
I''m doing this
@condition = ''''
if(params.....)
@condition = @condition + " myparamter = " + params[.....
if(params.....)
@condition = @condition + " myparamter = " +
2006 Mar 03
3
dynamic queries
Is there an easy (and secure) way to search your database when you don''t
know the number of parameters ahead of time? I can see doing it by
concatenating together an sql query, but hopefully rails provides a more
elegant way to do this with ActiveRecord without making a ginormous switch
statement?
For example, lets say my search form has 4 different input boxes. I only
want the query
2006 Mar 13
6
Specifying none/single/many conditions at the same time
Hi!
It''s rather ruby question than rails...
I have a single ''list'' action where i call paginate method.
I can receive none, 1 or 2 variables that specify conditions for
paginate method.
How to write the code so i can call paginate without conditions if all
conditions variable are nil, with a single condition if one of
conditions variables is not empty and with 2 if
2006 May 23
3
ez-where headscratch
Hi there,
I''m puzzled by this apparently simple query I can''t manage to reassemble
using ez_where plugin.
cond = Caboose::EZ::Condition.new :my_table do
start_on < Time.now
any {end_on > Time.now; end_on.nil?}
end
I keep getting the following result :
>> cond.to_sql
=> ["my_table.start_on < ? AND (my_table.end_on > ?)", Tue May 23
2006 Feb 22
2
Using ez_where
Hi All,
I am trying to pass values to ez_where to construct my conditions. I
need
to know how the params need to be formated for ez_where.
My search class looks like this:
def search
@display_ad = DisplayAd.new(params[:display_ad])
cond = Caboose::EZ::Condition.new do
pub_date == ''@display_ad.pub_date''
io_number =~
2006 Feb 15
10
STI Question
Hi everyone,
I have 3 types of people (for now):
Staff
Faculty
Students
To break them up into classes, but keep them in the same People table,
I''ve broken them up like so (code and ''ends'' snipped):
class Person < ActiveRecord::Base
class Employee < Person
class Staff < Employee
class Faculty < Employee
class Student < Employee
So, when I insert
2006 Apr 18
3
ez_where query question
I''m having fun composing queries with ez_where, but am stuck on how to
formulate the following using the ez syntax:
(begin_date >= ? OR end_date >= ?) AND (description LIKE ? OR name LIKE ?)
There are two clauses, each containing OR operators (the ez ''any'' syntax)
but both clauses must evaulate to true for a match.
Can anyone suggest the proper way to construct
2006 May 02
3
Writing tests for plugins
I''ve been googling around trying to find some tips on creating tests for
plugins. Am I correct in assuming that I''d have to have the tests as
part of a rails app in order to test the plugin? I''d like to find a way
to do standalone tests for the plugin.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
4
How to write this SQL query?
Hi!
Is there rails version of "where column in (value1, value2, ...)"?
I know i could do OR many times, but this way is shorter.
I''m ruby/rails newbie, so i have a problem with converting the hash,
which i''m receving from the search form into the string for :conditions
in find method.
Could i instead of creating one, complicated (for me) query do something
like
2006 Feb 24
2
raking my brain to fix this
I am ''raking'' my brain to fix this problem - I have searched, googled,
looked through rake documentation, wiki.rubyonrails and I can''t fix...
This works
$ rake plugindoc
(in /home/craig/ruby-db/th-db)
rdoc -o doc/plugins/ez_where --title ''Ez Where Plugin Documentation'' --
line-numbers --inline-source -T html
2006 Apr 15
2
ez_where : i''m puzzled
I have the following code:
condition_clause = "%#{@phrase}%"
logger.info "condition is #{condition_clause}"
unless @phrase.nil?
condition = Caboose::EZ::Condition.new :affiliates do
affiliate_name =~ "%#{@phrase}%" # <<< here''s the problem
end
options[:conditions] = condition.to_sql
logger.info "ajax
2007 Apr 19
5
Chinese full text searching by acts_as_ferret?
How to add Chinese language full text searching function by using
acts_as_ferret?
RegExpAnalyzer.new(/./,false)
this analyzer, i don''t know how to use it!
does it works like this:
user searching---->acts_as_ferret---->ferret
????
--
Posted via http://www.ruby-forum.com/.