Aaron Patterson
dcdfc84f55
use quoted id of single AR::Base objects in predicates
2010-11-15 14:35:38 -08:00
Neeraj Singh
7c5c1a07c0
if association is already loaded and if a find operation is performed on the already loaded association list with an empty hash then do not perform another sql
...
[#5972 state:resolved]
2010-11-15 10:12:23 -08:00
Aaron Patterson
022519a032
fisting a bunch of unused variable warnings
2010-11-15 10:12:09 -08:00
Santiago Pastorino
bc556a21e2
Remove unused var
2010-11-14 15:34:07 -02:00
Jason Cheow
93c9f4a942
Fix bug where size of through association is not correct after adding a has_many association (occurs only before main object has been reloaded).
...
[#5968 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-14 15:32:52 -02:00
Franck Verrot
983976ec54
Finder gives a little bit more info on the lookup column (primary key)
2010-11-13 06:32:08 +08:00
Santiago Pastorino
b734e192a7
present? is better here
2010-11-11 19:00:33 -02:00
José Valim
f912a359aa
Merge remote branch 'drogus/plugin_new'
...
Conflicts:
railties/test/generators/app_generator_test.rb
2010-11-11 19:39:21 +01:00
Franck Verrot
de2933e1a0
STI type is now updated when calling AR::Base.becomes on subclasses [ #5953 state:resolved]
2010-11-12 02:17:34 +08:00
Santiago Pastorino
296e5c38f1
Use ! instead of not
2010-11-11 15:24:49 -02:00
Santiago Pastorino
894fd28859
Fixed bug in active_record/nested_attributes where an empty string id caused an ActiveRecord::RecordNotFound error. Found by [Ben Tillman]
...
[#5638 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-11 15:23:40 -02:00
Santiago Pastorino
ceef719924
Bump Arel up to 2.0.2
2010-11-11 15:05:12 -02:00
José Valim
9c9f416d39
Allow AR Session Store to be renewed
2010-11-11 14:17:14 +01:00
Xavier Noria
41366cdec6
syncs CHANGELOGs for 3.0.2 in 3-0-stable with the ones in master
2010-11-09 20:56:41 +01:00
Santiago Pastorino
88a559d414
Double negation of an already boolean value produces the same result
2010-11-09 16:53:03 -02:00
Santiago Pastorino
75dfd95618
Don't check if persisted is defined just initialize it properly
2010-11-09 16:00:02 -02:00
Santiago Pastorino
994a1c2a47
Execute less operations
2010-11-09 14:03:09 -02:00
David Chelimsky
1f06652a57
use persisted? instead of new_record? wherever possible
...
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
without concern for whether the extended object is specifically
ActiveRecord
[#5927 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-09 13:54:04 -02:00
Michael Koziarski
3d6eea0221
Update the validates_uniqueness_of documentation to tell you to use a unique index.
...
The other options mentioned were not good ideas and disclaimed as such in the documentation.
2010-11-08 10:16:40 +13:00
Raimonds Simanovskis
6709078eb1
use column names as order by complex function parameters, fix for postgresql adapter to correctly remove ASC/DESC
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2010-11-07 09:55:17 -02:00
Aaron Patterson
1acc086278
reduce duplication in assiciations #construct()
2010-11-06 18:20:08 -07:00
Aaron Patterson
c11102d4f8
make sure we keep parent records in order
2010-11-06 14:32:41 -07:00
Aaron Patterson
39a8056791
only call to_s on the association variable once
2010-11-05 17:08:56 -07:00
Aaron Patterson
c43d909ee2
simplify instantiate in the join parts object
2010-11-05 16:56:50 -07:00
Aaron Patterson
d89d702361
index is not used, so removing it
2010-11-05 16:56:50 -07:00
Aaron Patterson
a79e1de90a
reduce method calls to the join base object
2010-11-05 16:56:50 -07:00
Aaron Patterson
06d518a323
stop recursively calling exists?
2010-11-05 15:36:36 -07:00
Santiago Pastorino
00261a187e
Avoid warning: shadowing outer local variable
2010-11-05 16:34:23 -02:00
Santiago Pastorino
3146aa68fd
Fixes queries using limits and punctuation in order, removes order("col1, col2") usage in favor of order(["col1", "col2"})
...
[#4597 state:committed]
2010-11-05 11:27:34 -07:00
Aaron Patterson
d5e45931a0
renaming exec in the mysql adapter
2010-11-05 10:21:14 -07:00
Aaron Patterson
0f45f23669
renaming exec in the PG adapter
2010-11-05 10:15:33 -07:00
Aaron Patterson
9a08517c8d
converted exec to exec_query for sqlite
2010-11-05 10:08:38 -07:00
sblackstone
710dcf826a
Association Proxy should not undefine the default respond_to_missing
2010-11-04 15:02:27 -07:00
Aaron Patterson
fa4686243c
ignoring certain SQL when using Oracle
2010-11-03 17:34:49 -07:00
Aaron Patterson
6367e95867
select goes through exec(), so no method chaining for query counts
2010-11-03 17:34:49 -07:00
Aaron Patterson
5c6978608d
use bind params in select with query monkeypatch
2010-11-03 17:34:49 -07:00
Piotr Sarnacki
cfbe595831
Use application's generators defaults as engine defaults to not force users to manually set it
2010-11-02 17:14:52 +01:00
Pratik Naik
18b6aa6538
Make should_record_timestamps? serialization aware rather than object#changed?
2010-11-02 01:45:30 +00:00
Pratik Naik
e911ed1f0f
Ensure save always updates timestamps when serialized attributes are present
2010-11-02 01:42:49 +00:00
Pratik Naik
c5c2e4fefd
Add timestamps to Topic
2010-11-02 01:24:31 +00:00
Aaron Patterson
296467fcc4
only returning where values for the corresponding relation, also filtering where value hash based on table name [ #5234 state:resolved] [ #5184 state:resolved]
2010-10-30 13:25:49 -07:00
Aaron Patterson
cbca12f908
adding tests for #5234 and #5184 . Tests were from Akira Matsuda. Thanks Akira!
2010-10-30 13:20:54 -07:00
Aaron Patterson
7d5762d2c2
no need to merge where values if no new where values have been added
2010-10-30 12:28:49 -07:00
Denis Odorcic
cc9742920c
Convert :primary_key in association to a string before comparing to column names, so that for example :primary_key => :another_pk works as well [ #5605 state:resolved]
2010-10-30 11:24:36 -07:00
Aaron Patterson
67a3a70295
refactoring find_join_association
2010-10-30 08:45:40 -07:00
Ernie Miller
0bb85ed9ff
Fix issues when including the same association multiple times and mixing joins/includes together.
2010-10-30 06:48:44 -07:00
Jon Leighton
b82fab25f9
Refactoring: replace the mix of variables like @finder_sql, @counter_sql, etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly.
2010-10-30 06:30:00 -07:00
Aaron Patterson
2a47e7ef10
only do string substitution on column names once, remove intermediate data structures
2010-10-30 06:16:54 -07:00
Aaron Patterson
2e07260f36
columns are always strings
2010-10-30 06:12:50 -07:00
Aaron Patterson
6cf44a1bd6
no need to to_i, sqlite does that for us
2010-10-30 06:11:06 -07:00