Emilio Tagua
32e296b6ff
Use new finders syntax in docs.
2010-09-01 12:16:08 -03:00
Pratik Naik
db6190a022
Make all the Relation finder methods consistent
2010-08-31 22:25:28 +01:00
Pratik Naik
dce0cfae8b
Merge remote branch 'miloops/rails_master_fixes'
2010-08-31 22:05:42 +01:00
Pratik Naik
7694b97ddf
Remove default values for Relation#limit/offset/from/create_with
2010-08-31 21:56:21 +01:00
Emilio Tagua
c11eec8482
Avoid calling build_where is no argument is given.
2010-08-31 15:47:59 -03:00
Pratik Naik
c07f0ae52e
Change relation merging to always append select, group and order values
2010-08-31 19:17:18 +01:00
Emilio Tagua
87e50f104a
Improved conditionals usage to prevent calling methods.
2010-08-31 15:06:02 -03:00
Emilio Tagua
2431af1b7f
Don't test conditional in iteration if it is not present just clone it.
2010-08-31 13:19:06 -03:00
Santiago Pastorino
68a949bae7
PERF: Avoid two method calls
2010-08-28 21:35:20 -03:00
Xavier Noria
fa8e17b5c2
Merge remote branch 'docrails/master'
2010-08-26 01:39:16 +02:00
Aaron Patterson
ffdda4ddfb
use blank? instead of present?, mark SQL literals as SQL literals
...
Conflicts:
activerecord/lib/active_record/relation/query_methods.rb
2010-08-25 05:17:49 -07:00
Aaron Patterson
b28cafe01a
no need to send on a public method
2010-08-25 05:17:49 -07:00
Aaron Patterson
ce7c2f72f4
refactor select { is_a? } to grep()
2010-08-25 05:17:49 -07:00
Neeraj Singh
4e40f00565
minor formatting fixes
2010-08-25 07:39:47 -04:00
Aaron Patterson
5931a1dbd3
sql literal strings should be marked as sql literal strings
2010-08-23 13:57:22 -07:00
Aaron Patterson
a70248c3d8
we should wrap strings as sql literals
2010-08-19 10:35:09 -07:00
Aaron Patterson
e4f424d577
refactoring to remove duplicate logic
2010-08-18 12:10:48 -07:00
Aaron Patterson
93f335b6fb
call to present? is not necessary
2010-08-18 11:51:59 -07:00
Santiago Pastorino
b451de0d6d
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
2010-08-14 04:12:33 -03:00
Prem Sichanugrist
a7eb8d97a4
Removing most of the symbol to proc usage in Active Record
...
This will hopefully make Active Record run a bit more faster.
2010-08-13 16:24:49 -07:00
Aaron Patterson
b9eec677c4
avoid direct use of arel constants
2010-08-13 13:33:08 -07:00
Neeraj Singh
6ed1ba472e
Ensure we can nest include calls [ #5285 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-08-12 13:10:58 -03:00
Aaron Patterson
7de03ec765
subtracting blank strings is slightly faster than blank?
2010-08-11 15:45:06 -07:00
Aaron Patterson
06dc884454
avoid multiple hash lookups
2010-08-11 15:00:08 -07:00
Aaron Patterson
0f502ab88f
avoiding tap saves us time
2010-08-11 11:44:08 -07:00
Aaron Patterson
2b8f24998e
unless Array#empty? is faster than if Array#present?
2010-08-11 11:44:04 -07:00
Aaron Patterson
3c11e92616
stop using private methods
2010-08-11 11:43:57 -07:00
Xavier Noria
4f7565c4de
adds missing requires for Object#try
2010-08-09 15:25:21 +02:00
Aaron Patterson
117b096d0a
avoid passing lists of lists to the group clause
2010-08-04 16:24:01 -07:00
Aaron Patterson
ec736dff7b
call to_a since we are not passing anything to all()
2010-08-04 14:22:29 -07:00
Aaron Patterson
30abb01d07
fisting indentation
2010-08-04 14:11:30 -07:00
Aaron Patterson
cff7f53fbc
do not pass AR objects to ARel
2010-08-04 08:44:53 -07:00
Aaron Patterson
6d6ed55324
avoid passing AR::Base objects to Arel when we can
2010-08-03 17:58:56 -07:00
Aaron Patterson
41c1aa607d
order query is already a string, no need to to_s
2010-08-03 09:16:01 -07:00
Neeraj Singh
1ce40ca562
ensuring that description does not exceed 100 columns
2010-08-02 12:25:26 -04:00
Aaron Patterson
834e304b22
reverting where() functionality, adding a test
2010-07-30 14:12:01 -07:00
Aaron Patterson
ecfb252e7a
fewer method calls, using faster methods when possible
2010-07-30 14:05:26 -07:00
Aaron Patterson
d1c53a9ad2
reducing function calls and using faster methods for testing
2010-07-30 13:38:09 -07:00
Aaron Patterson
a7a6a2ff46
got the ternary backwards. somehow the sqlite tests passed!
2010-07-29 16:08:30 -07:00
Aaron Patterson
f171bc64a2
PERF: avoiding splat args and reducing function calls
2010-07-29 14:55:57 -07:00
Aaron Patterson
d69949ed0d
Shouldn't have committed this! Revert "avoid calling to_sql twice"
...
This reverts commit 1c030a3c3c .
2010-07-28 17:03:52 -07:00
Aaron Patterson
1c030a3c3c
avoid calling to_sql twice
2010-07-28 17:01:32 -07:00
Pratik Naik
0c2c893434
Revert "Style fixes"
...
This reverts commit 3c300b3121 .
2010-07-15 13:17:35 +01:00
wycats
3c300b3121
Style fixes
2010-07-14 17:33:07 -07:00
Pratik Naik
4a06489525
Style fixes
2010-07-14 16:50:26 +01:00
Ken Collins
0e9bc23c0e
Fix the #using_limitable_reflections? helper to work correctly by not examining the length of an array which contains false/true, hence always passing. [ #4869 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-07-08 22:34:34 +02:00
José Valim
af6ec607fa
No need to check if the attribute exists (this is the same behavior as in 2.3) [ #4994 state:resolved] and [ #5003 state:resolved]
2010-06-29 20:15:32 +02:00
Neeraj Singh
dabf74b495
array subtraction should be faster than iterating over all the elements
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-06-29 17:57:06 +02:00
José Valim
bd1666ad1d
Add scoping and unscoped as the syntax to replace the old with_scope and with_exclusive_scope. A few examples:
...
* with_scope now should be scoping:
Before:
Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
After:
Comment.where(:post_id => 1).scoping do
Comment.first #=> SELECT * FROM comments WHERE post_id = 1
end
* with_exclusive_scope now should be unscoped:
class Post < ActiveRecord::Base
default_scope :published => true
end
Post.all #=> SELECT * FROM posts WHERE published = true
Before:
Post.with_exclusive_scope do
Post.all #=> SELECT * FROM posts
end
After:
Post.unscoped do
Post.all #=> SELECT * FROM posts
end
Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values:
Post.unscoped.all #=> SELECT * FROM posts
2010-06-29 17:18:55 +02:00
Santiago Pastorino
093c4eedd0
Remove unneeded reject
2010-06-28 19:14:40 -07:00