José Valim
192e55c38e
Do not raise an exception if an invalid route was generated automatically.
2011-12-16 10:45:59 +01:00
José Valim
8854bf29a3
Set up delegations also for to_a and arel branches.
2011-12-15 20:59:05 +01:00
José Valim
b17bc58c76
Move delegation reponsibilities of Relation to a module. Also precompile method missing calls for rofscale.
2011-12-15 20:47:26 +01:00
Bogdan Gusiev
a382d60f6a
ActiveRecord::Relation#pluck method
2011-11-30 11:03:00 +02:00
Aaron Patterson
bd2f5c062d
pushing caching and visitors down to the connection
2011-11-19 20:19:53 -08:00
Ryan Naughton
63a22ca616
Fixes issue #3483 , regarding using a mixture of ranges and discrete values in find conditions. Paired with Joey Schoblaska.
2011-11-14 21:43:27 -06:00
Akira Matsuda
74c6e80cab
exclude ORDER BY clause when querying Relation#exists?
2011-11-09 04:51:11 +09:00
Jon Leighton
562583c766
Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL query
2011-11-05 16:22:18 +00:00
Vijay Dev
ed1ada84ac
copy edits 908f2616
2011-09-20 19:46:59 +05:30
Ryan Bigg
908f2616d5
Document ActiveRecord::QueryMethods#select
2011-09-17 16:08:58 -07:00
Vijay Dev
dcd70773fc
minor edit
2011-09-14 23:15:18 +05:30
Ryan Bigg
681c4dbb02
Add documentation for the extending method in ActiveRecord:QueryMethods
2011-09-14 09:43:31 +10:00
Jon Leighton
db8d54ebf5
Merge pull request #2485 from akaspick/exists_fix
...
fix exists? to return false if passed nil (which may come from a missing
2011-09-07 00:38:51 -07:00
Damien Mathieu
5f5527c726
Use LIMIT sql word in last when it's possible
2011-09-05 14:37:37 +02:00
Damien Mathieu
451cdd62ce
use LIMIT SQL word in first - Closes #2783
2011-09-05 13:09:52 +02:00
Arun Agrawal
9066e34025
We need to recorder here. Need to drop the order from default scope.
...
Fixes #2832
2011-09-05 00:12:57 +05:30
Jon Leighton
ef7e60f008
Revert "Fixes bug in ActiveRecord::QueryMethods, #1697 "
...
This reverts commit 0df27c98d9 .
Reverted due to failing test, see #2845 .
2011-09-04 09:56:55 +01:00
Joshua Wehner
0df27c98d9
Fixes bug in ActiveRecord::QueryMethods, #1697
...
Replace split on comma with a regexp that will reverse all ASC/DESC specifically
2011-08-31 16:17:28 -04:00
Jon Leighton
735d985b01
The join_nodes must be passed to the JoinDependency initializer and therefore counted by the alias tracker. This is because the association_joins are aliased on initialization and then the tables are cached, so it is no use to alias the join_nodes later. Fixes #2556 .
2011-08-29 15:05:47 +01:00
Ernie Miller
f74f5f7f00
Fix PredicateBuilder clobbering select_values in subquery.
2011-08-20 13:16:39 -04:00
Ernie Miller
e2ae015952
Fix assumption of primary key name in PredicateBuilder subquery.
2011-08-20 13:00:26 -04:00
Andrew Kaspick
d48dd18bb2
fix exists? to return false if passed nil (which may come from a missing URL param)
2011-08-10 12:55:29 -05:00
Jon Leighton
7db90aa7c7
Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
2011-08-08 23:28:23 +01:00
Jon Leighton
971a74b81f
Revert "Merge pull request #2309 from smasry/master"
...
This reverts commit 9d396ee819 , reversing
changes made to fa2bfd832c .
Reason: the change broke the build.
2011-07-28 13:14:11 +01:00
Samer Masry
18d307ed94
Reverse order fix when using function for ActiveRecord::QueryMethods Fixes #1697
2011-07-27 10:17:25 -07:00
Dmitriy Kiriyenko
9a298a162c
Fixed failing query when performing calculation with having based on select.
2011-07-27 16:48:15 +03:00
Piotr Sarnacki
14c6fca9cd
Revert "allow select to have multiple arguments"
...
This reverts commit 04cc446d17 .
I reverted it because apparently we want to use: select([:a, :b])
instead of select(:a, :b), but there was no tests for that form.
2011-07-26 16:15:12 +02:00
Sławosz Sławiński
04cc446d17
allow select to have multiple arguments
2011-07-26 14:57:47 +02:00
Franck Verrot
77bb0b79f2
Ordering with extra spaces was raising a SQL exception
2011-07-24 08:18:04 +02:00
Vijay Dev
02cbaf0593
avoid Symbol#to_proc
2011-07-20 00:28:51 +05:30
Elliot Winkler
0e1d617b8b
ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL
2011-07-18 14:56:37 -06:00
Santiago Pastorino
d632e927ec
Merge pull request #1807 from caius/find_in_batches_id_bug
...
Bugfix by stopping find_in_batches using the records after yielding.
2011-07-14 07:57:04 -07:00
Santiago Pastorino
c3732bfed0
Merge pull request #1823 from gnarg/master
...
Log instrumentation name for exists? queries
2011-07-10 18:02:31 -07:00
Akira Matsuda
d1545bcf94
fix AR having() not to raise NoMethodError when the given argument does not respond to empty?
...
having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs
2011-07-09 20:14:41 +09:00
knapo
2ca9b6dfab
Make ActiveRecord::Batches#find_each to not return self.
...
This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
2011-07-07 11:40:11 +02:00
Ernie Miller
2bdad7669c
Remove case statement changes from 2e0840d and 56ac32a. Inheritance FTW.
2011-07-06 16:13:57 -04:00
Santiago Pastorino
c713cf9a5d
Merge pull request #1273 from jeremyf/feature-association-proxy-send
...
Addresses an inconsistency in the ActiveRecord::Base.method_missing handl
2011-07-06 13:05:58 -07:00
Bogdan Gusiev
e7bec4e435
Fixed AR::Relation#sum compatibility with Array#sum
...
In order make Relation behavior closer to Array
Made Relation#sum to accept block and delegate it to Array#sum
2011-07-05 14:36:20 +03:00
Oriol Gual
56ac32ad51
Fix case
2011-06-28 22:31:24 +02:00
Oriol Gual
2e0840dd04
Update reverse order with new Arel Nodes
2011-06-28 22:22:26 +02:00
Aaron Patterson
997aed24be
default create_with_value to a hash so we can eliminate conditionals, add test surrounding create_with(nil) behavior
2011-06-27 14:18:49 -07:00
Jon Leighton
87d6865bf7
Apply the default scope earlier when doing calculations. Fixes #1682 .
2011-06-23 19:57:49 +01:00
Jon Guymon
618300f05a
Log instrumentation name for exists? queries
2011-06-22 13:41:34 -07:00
Caius Durling
96be08de25
Stop find_in_batches using the records after yielding.
...
Currently if the code that calls .find_in_batches modifies the yielded array in place then .find_in_batches can enter an infinite loop searching with ruby object ids in the database instead of the primary key of records in the database. This happens because it naively assumes the yielded array hasn't been modified before calling #id on the last object in the array. And ruby (1.8 at least) alias' #id to #object_id so an integer is still returned no matter what the last object is.
By moving finding the #id of the last object before yielding the array it means the calling code can do whatever it wants to the array in terms of modifying it in place, and .find_in_batches doesn't care.
2011-06-21 19:55:21 +01:00
Ernie Miller
08f3f30994
Support reversal of ARel orderings in reverse_sql_order
2011-06-20 14:15:19 -04:00
Brian Mathiyakom
1e43bd9f35
Fix issue #1272
...
Set reverse_order_value when asked to reverse_order().
Do the actual reversal in build_arel.
2011-06-01 18:29:29 +01:00
Jon Leighton
fbe012e92d
Ensure that calculations properly override the select value even if it's set in the default scope. Fixes #1395 .
2011-05-31 21:12:20 +01:00
Xavier Noria
00e1d0832e
Merge branch 'master' of git://github.com/lifo/docrails
...
Conflicts:
actionmailer/lib/action_mailer/base.rb
activesupport/lib/active_support/core_ext/kernel/requires.rb
2011-05-25 22:48:47 +02:00
Jeremy Friesen
f2a0dfc298
Addresses an inconsistency in the ActiveRecord::Base.method_missing handling of dynamic finder methods and the passing of the &block parameter for :find_by_attributes.
2011-05-24 13:52:48 -04:00
Sebastian Martinez
0034b7822d
Remove extra white spaces on ActiveRecord docs.
2011-05-23 20:58:25 -03:00