Displaying 9 results from an estimated 9 matches for "add_condit".
2005 Dec 01
0
[MySQL] extended count function for use with queries containing a GROUP BY clause
...cord
class Base
class << self
def count(conditions = nil, joins = nil)
if joins =~ /GROUP BY/
sql = "SELECT SQL_CALC_FOUND_ROWS * FROM #{table_name} "
sql += joins if joins
sql += '' LIMIT 0''
add_conditions!(sql, conditions)
connection.execute(sql)
sql = ''SELECT FOUND_ROWS()''
else
sql = "SELECT COUNT(*) FROM #{table_name} "
sql << " #{joins} " if joins
sql << ''LIMIT 1'...
2007 Sep 14
4
Refactoring ActiveRecord's private methods
As it currently stands, ActiveRecord has alot of private and protected
methods in the Base class.
>> ActiveRecord::Base.methods.size
=> 427
>> ActiveRecord::Base.protected_methods.size
=> 32
>> ActiveRecord::Base.private_methods.size
=> 193
I really loved the suggestion by Courtenay in Refactoring
AR::Base.find (http://groups.google.com/group/rubyonrails-core/
2006 Feb 19
2
progressive updates
I have a list view and have it sorting the data presented in the list
view by clicking on the top of the column - that works fine.
Now, I want to add a pop up-list which controls 3 different levels of
record select to be presented in this list...
- ALL
- placement.discharge_date IS NULL
- placement.discharge_date IS NOT NULL
I can have 3 different ''methods'' and
2005 Mar 23
1
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
...1.8/gems/activerecord-1.9.0/lib/active_record/base.rb:841:in
`replace_bind_variables''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.9.0/lib/active_record/base.rb:830:in
`sanitize_sql''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.9.0/lib/active_record/base.rb:732:in
`add_conditions!''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.9.0/lib/active_record/base.rb:356:in
`find_all''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.9.0/lib/active_record/base.rb:378:in
`find_first''
/app/models/user.rb:7:in `authenticate''
app/c...
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
.../1.8/gems/activerecord-1.14.2/lib/active_record/base.rb
:1287:in `replace_bind_variables''
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb
:1276:in `sanitize_sql''
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb
:1062:in `add_conditions!''
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb
:1012:in `construct_finder_sql''
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb
:924:in `find_every''
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/li...
2006 Mar 16
1
Rails SQL generation (Firebird adapter) - can someone explain ...
I see some possible issues with the SQL that is being generated by the
firebird adapter.
Every SQL is being generated on the fly by concatenating strings.
Can someone please explain why the SQL is being generated the way it is?
I cannot use this in real life for a couple of reasons:
1. This introduces a security hole because a user, accidentally or
deliberately, could potentially submit a
2006 Jan 05
2
Rails 1.0 Crashing: Errno::EPIPE (Broken pipe):
.../activerecord-1.13.2/lib/active_record/base
.rb:1133:in `replace_bind_variables''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base
.rb:1122:in `sanitize_sql''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base
.rb:942:in `add_conditions!''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base
.rb:921:in `construct_finder_sql''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base
.rb:395:in `find''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1...
2007 Aug 06
4
problem with rails_root
.../gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1416:in
`sanitize_sql_array''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1387:in
`sanitize_sql''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1163:in
`add_conditions!''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1096:in
`construct_finder_sql''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:997:in
`find_every''
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/l...
2006 Jun 19
3
can''t dump anonymous class Class
I''m trying to create a document upload system, where most of the code is
the super class Document and just the path to file on the system is
controlled by the sub classes. When I attempt to use my code, I get the
following when I try to save the document.
can''t dump anonymous class Class
Any ideas?
** Migration **
class CreateDocuments < ActiveRecord::Migration
def