search for: conditions_from_hash

Displaying 2 results from an estimated 2 matches for "conditions_from_hash".

2006 Apr 13
2
Dynamic finder conditions
...but I''m embarrassed of it so I won''t show it here). Is there already something like this out there? Also, is there any way I can make my code more Ruby-fied? Here''s what I have so far: --application.rb private #this could probably stand to be renamed def dynamic_conditions_from_hash(some_hash, model) model = Class.new(model) some_hash.delete_if { |key, value| not model.column_names.include? key } conditions_from_hash(some_hash) end def conditions_from_hash(some_hash) condition = '''' some_hash.each_pair {|key, value| if value.empty?...
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