similar to: variable variables?

Displaying 20 results from an estimated 500 matches similar to: "variable variables?"

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 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 23
8
SQL quoting for :order parameter
When I construct a query using variables I do something like this: @users = User.find(:all, :conditions => ["location = ?", location]) I would like to do the same sort of thing in the :order parameter. @users = User.find(:all, :order => ["? ASC", location]) When I try this though I get a SQL error and I see that the items in the array were concatenated together and
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 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 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 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 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 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 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 Jul 12
12
pass hash as parameter
Hello, How can I pass a hash as parameter from a template with url_for? e.g. : if I have test = { :a => "a", :b => "b" } How can I pass that with my request? Is it possible to pass nested hash''es to? Right now, url_for :action => :test, test doesn''t seem to work. Thank you, --
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 Dec 26
15
is there a way to not repeat installing plugins?
i seem to be using the same plugins for all my sites and was wondering if there is a way to make the process easier and faster? is this what is called by "packing your own gems"? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2006 Jul 19
6
ActiveRecord::RecordNotSaved - bizarre behaviour.
Hi. I get a RecordNotSaved exception when trying to create a user record. The error: User Columns (0.005930) SHOW FIELDS FROM users SQL (0.000465) BEGIN SQL (0.000466) COMMIT ActiveRecord::RecordNotSaved (ActiveRecord::RecordNotSaved): ... As you can see, there''s no INSERT SQL generated, which is the root cause of the problem. In my user model, I have the following
2011 Apr 18
12
Arel - clone bug (and fix), feature requests
Hi all, I''ve been playing around with Arel this week (actually outside of Rails) and found an issue with the clone implementation. I''ve added a patch and a testcase here: https://github.com/codders/arel/commit/660f706491ac012cb133554cffeaa6b9ae6046e9 and made a pull request against the rails/arel repo. I''ve also been playing around with support for ordering on
2012 Mar 28
4
Hash iteration order in a template not consistent
Hi, I did some basic googling, but didn''t find an answer yet. I am sorry if this is a FAQ. In a manifest for creating an Apache config file, I define a hash like this: $aliases = { ''/foo/'' => ''/home/foo/www/'', ''/bar/'' => ''/home/bar/www/'', ''/baz/'' =>
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 May 25
3
Storing BigDecimal in the db
I need to do some precise math, going to 12-14 decimal places, so I''m using BigDecimal. How can I store this in a db? I''m using postgresql 8.1.0, if that matters at all. I found a plugin [1] but it gives me the error "You have a nil object when you didn''t expect it! The error occurred while evaluating nil.each_pair," with no line number. The plugin itself
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