Displaying 20 results from an estimated 500 matches similar to: "ez_where query question"
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
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 Aug 02
5
Fun with ez_where
I''ve been trying to use the ez_where plugin to create a dynamic finder.
The structure looks somehing like this..
=== controller ===
def list
attribute_filter = params[:filter]
@filter = Caboose::EZ::Condition.new :table do
attribute <=> attribute_filter if attribute_filter
end
#
... do the find with the @filter
#
end
=== view ===
....
<%= link_to
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 Jul 28
2
ez_where: Stuck Again
I just keep thinking this is going to slice through queries like a hot knife
through butter, but... there''s something I''m not getting. Here''s the gist:
# get the people like the search criteria
Members.find(:all, :conditions => [''first LIKE ? OR last LIKE ?'',
params[:search], params[:search])
joined with the alternative of
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 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 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 Jun 14
6
find and LIKE ''xxx%'' clause
Hi there !
I try to figure out how to do something like this in Rails :
SELECT * FROM my_table WHERE name LIKE ''GOGONAM%''
My problem is the % and the quotes.
>From now, I do like this :
searched_name = params[:name]+''%''
user = MyTable.find(:all, :conditions => ["name LIKE ?", searched_name])
But is there a more gracefull way to do a LIKE
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 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 Apr 16
3
variable variables?
Hi everyone,
Does Ruby support variable variables like PHP
(http://www.php.net/manual/en/language.variables.variable.php)? Or do I have
to use eval, like
some_hash.each_pair{|key, pair|
eval "#{key} = #{value}"
}
Or is there some other way?
I''m actually trying to figure this out in order to use ez_where to create
its conditions from a hash, so if this isn''t even
2006 Mar 20
16
logic inside a view file
I am quite certain I have heard it said not to put business logic inside
view code but I have a report that I want to display 3 different
possibilities of text based upon the value of a column. Would I just
take the same type of if/then logic that I would use in a controller and
put it inside erb <%= %> stuff?
Craig
2006 Jan 16
1
Bundled resource -- something I''m missing
I have a decoupled form embedded in my pages ? a search box that has date
fields ? and of course the search fields are not in my model. However,
picking dates is a great use for the Dynarch calendar. It seems that by
using the syntax:
<%= render :partial => ?filter_box? %>
In my view and...
<%= dynarch_date_select ''filter_box'', ''begin_date'' %>
2006 Dec 11
1
Compute date during before_validation_on_create
Hello,
- the form posted by the user have a date field
- this date is begin_date, I need to compute end_date
- so, added callback before_validation_on_create
- in this method I do :
end_date = begin_date >> 12
- unfortunately, beeing in before_validation the actual self.begin_date
have not been type casted - It''s always a string
- unfortunately again, I can''t put this code
2008 Oct 14
4
replace_html not working
hallo, everyone
can anybody help me? i did add my code under ENGINES as a module in a
project. before the change , all worked . and the differenz between
both is only about application''s environment,
before is
Ruby version 1.8.6 (i486-linux)
RubyGems version 1.1.1
Rails version 2.0.2
Active Record version 2.0.2
Action Pack version 2.0.2
2006 Jan 17
4
find_by_sql column ordering defect?
Hello.
I have a program that accesses a metadata (translation) table for column
names as well as the ordering of columns for a specific model. Also in
there is a collection of bool options such as column_visible_on_form,
column_visible_on_screen_quicklist etc. The idea is that our customer
can specify to a certain extent how their layout/user interface will
appear.
To accomplish this, I use
2005 May 19
5
[OT] Sqlite2 question
So, under Sqlite2, if I want to update a database''s schema, I have to
dump the DB, modify the table''s structure, then go and modify EVERY
insert statement.
The insert statements look like (from memory):
INSERT INTO my_table VALUES (''some_id'', ''some_val'', '''', '''', '''',
''some_other
2006 Nov 04
0
Ez_where question
Hi there
I''m playing with the ez_where plugin but am having trouble formulating a query.
Let''s say that if my params[:search_terms] come back as "Ruby Rails",
then I want to search for all books that have Ruby and/or Rails in the
title.
So how best to set up my ez_where conditions so that book.title is
LIKE %Ruby% and also LIKE %Rails% ?
Any clues appreciated.
2012 Jul 10
1
calculating the difference between days?
Hi List,
I have one column of beginning dates and one column of ending dates, I want
to find their difference. And I want to ignore the trailing zeros,
basically everything after the first colon mark.
Begin_date End_date
01JAN2000:00:00:00:000 02FEB2002:00:00:00:000
24MAR2012:00:00:00:000 18MAY2012:00:00:00:000
01OCT2003:00:00:00:000