search for: ez_where

Displaying 20 results from an estimated 37 matches for "ez_where".

Did you mean: elswhere
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''...
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. Ca...
2006 Apr 15
2
ez_where : i''m puzzled
...erything works. I''ve ascertained that by the time I''m in operator=~, all that''s left is ''%%''. Is there something obvious I''ve missed about this straightforward variable interpolation? TIA -- View this message in context: http://www.nabble.com/ez_where-%3A-i%27m-puzzled-t1455038.html#a3932303 Sent from the RubyOnRails Users forum at Nabble.com.
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 17:11:43 CEST 2006, Tue...
2006 Jul 28
2
ez_where: Stuck Again
...[''first LIKE ? OR last LIKE ?'', params[:search], params[:search]) joined with the alternative of member.comments.needs_followup <> 0 iff there is a params[:followup] and it is equal to 1. Does this make sense? Thanks -- View this message in context: http://www.nabble.com/ez_where%3A-Stuck-Again-tf2017867.html#a5548178 Sent from the RubyOnRails Users forum at Nabble.com.
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 vendor/plugins/ez_where/lib/caboose/clause.rb vendor/plugins/ez_where/lib/caboose/condition.rb vendor/plugins/ez_where/lib/caboose/ez.rb vendor/plugins/ez_where/lib/caboose/hash.rb...
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 @filte...
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% a...
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 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 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 Apr 16
3
variable variables?
...uby 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 necessary could someone let me know? Thanks, Daniel
2006 Jan 31
11
ez_where plugin updated features.
...ax. 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 added a bunch of great code. You can get it from here: http://http://brainspl.at/opensvn.csie.org/ezra/rails/plugins/dev/ ez_where/ This is a request for feedback. I want to solidify the api soon so suggestions are welcome. Here''s a snippet from the README: Welcome to the new improved ez_where plugin for rails. This plugin is meant to be used as a nice ruby like syntax for creating the :conditions part of an...
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 Aug 07
2
Dynamically created queries
Hello, I am having difficulty dynamically building a query. I want to ensure that I''m using Active Record protection against SQL injection attacks. In PHP land, I would have built up the query in my logic & attempted to clean every variable - a bit tedious really. I want to be able to achieve something like: events = Event.find(:all, :conditions => [**DynamicallyBuiltQuery**
2006 Jun 30
3
New release of ez-where plugin
...? OR articles.body LIKE ? OR articles.extended LIKE ?) AND ((authors.name = ?) OR (comments.body LIKE ?))", "%foo%", "%foo%", "%foo%", "Ezra", "% foo%"] More examples on my blog: http://brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin Get it here: $ script/plugin install svn://rubyforge.org//var/svn/ez-where Mailing list here: http://rubyforge.org/mailman/listinfo/ez-where-devel Cheers- -Ezra -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/...
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 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
2006 Jul 05
2
How to make a search between two values ?
Hi, I would like to know if it was possible to make a search between two values : For example, I have a table Assignation : - name (varchar) - frequency (integer) - created_on (date) And I would like to sort all the names of the assignation which have a frequency betwenn 100 kHz and 500 kHz, or sort all the names that has been created between two given dates. For the moment, the only thing