Santiago Pastorino
216d79ef63
Revert "to_key on a destroyed model should return nil". Closes #2440
...
This reverts commit c5448721b5 .
2011-08-05 19:40:05 -03:00
Xavier Noria
9efc57f2b7
Revert "Explicitly included hashes in sentence regarding SQL-injection-safe forms"
...
Reason: The hash form is secure, and preferred over the array form if possible.
This reverts commit 6dc749596c .
2011-08-04 16:57:43 -07:00
Vijay Dev
c93adf85a7
make the warning clear about the effect of using validates_associated on both sides on an association.
2011-08-04 16:48:34 -07:00
Pete Campbell
f9bd8b2a72
Explicitly included hashes in sentence regarding SQL-injection-safe forms
2011-08-04 16:45:21 -07:00
Aaron Patterson
c1b85edc2d
fixing deprecation notice for dynamic finders that use hashes. fixes #2404
2011-08-03 15:31:48 -07:00
Aaron Patterson
3e56758a95
add a migrate class method and delegate to the new instance
2011-08-02 20:03:15 -07:00
Christopher Meiklejohn
55eadccfbf
Support backwards compatible interface for migration down/up with rails 3.0.x.
2011-08-02 20:03:06 -07:00
Jon Leighton
048215a193
Revert "Replace inline lambdas with named methods" and "Don't wrap operations on collection associations in transactions when they are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database."
...
This reverts commits df63c99f06 and b17fd25a2d .
The change had unintended side effects, please see #2337 .
Conflicts:
activerecord/test/cases/associations/has_many_associations_test.rb
2011-07-30 23:05:20 +01:00
Aaron Patterson
d13df74c33
default writing the schema file as utf-8
2011-07-29 12:28:21 -07:00
Aaron Patterson
4e1f6ab6f6
dump IO encoding value along with schema.rb so the file can be reloaded. fixes #1592
2011-07-29 12:23:58 -07:00
Jon Leighton
e13e25dda5
Update deprecation messages to point out the availability of proxy_association. Fixes #1148 .
2011-07-27 12:44:17 +01:00
Jon Leighton
7bf9b9a170
Add a proxy_association method to association proxies, which can be called by association extensions to access information about the association. This replaces proxy_owner etc with proxy_association.owner.
...
Conflicts:
activerecord/lib/active_record/associations/collection_proxy.rb
activerecord/test/cases/associations_test.rb
2011-07-27 12:41:10 +01:00
Aaron Patterson
a5188333aa
bumping to rc5
2011-07-25 16:03:01 -07:00
John
12faf8087d
Fixed Typo
2011-07-25 23:27:17 +02:00
thedarkone
787194ee43
Bring back the ability to provide :order for update_all.
2011-07-25 16:12:58 +02:00
Oemuer Oezkir
8b30f1d7ea
Changed a few instances of of words in the API docs written in British English to
...
American English(according to Weber)
Conflicts:
actionpack/lib/action_controller/metal/request_forgery_protection.rb
railties/lib/rails/engine.rb
2011-07-24 21:10:51 +02:00
Santiago Pastorino
434bbb0efc
Revert "Merge pull request #2194 from cldwalker/after_initialize"
...
This reverts commit 198300727d , reversing
changes made to ae65c0b7a4 .
2011-07-23 20:49:42 -03:00
Santiago Pastorino
198300727d
Merge pull request #2194 from cldwalker/after_initialize
...
Fix after_initialize and Base.create edge case
2011-07-23 16:19:33 -07:00
Santiago Pastorino
0988da62e2
Merge pull request #2172 from arunagw/database-rake-1.9.2_3-1-stable
...
Database rake 1.9.2 3 1 stable
2011-07-23 07:59:02 -07:00
Vijay Dev
ed611fcde6
use simpler words in docs
2011-07-23 12:24:51 +02:00
Les Fletcher
3dc5f71c17
fix after_initialize edge case ( close #2074 and close #2175 )
...
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-22 20:14:48 -04:00
Arun Agrawal
8dc4745c7b
This conditions is required to work with database create task. 1.9.2 is having a bug with "Calling return within begin still executes else".
2011-07-21 09:53:44 +05:30
Aaron Patterson
9a6b96a61a
no need to sort the values
2011-07-20 15:57:45 -07:00
Franck Verrot
1d674d51b9
assign_nested_attributes_for_collection_association should work with Ruby 1.9 [ Closes #2106 ]
...
Children attributes can be either String's or Symbol's, so let's check if the object responds to to_i.
2011-07-20 15:57:40 -07:00
Aaron Patterson
56fb7fc1b2
bigdecimal should be typecast to a float on sqlite3. fixes #2162
2011-07-20 10:45:16 -07:00
Vijay Dev
f78a4e88f6
avoid Symbol#to_proc
2011-07-20 01:07:06 +05:30
Norman Clarke
b8e26e67d7
Explicitly require Active Support dependencies
...
This fixes errors when using Active Record outside of Rails. In Rails,
these files are required by other classes that are always loaded, so
this error does not happen.
Without core_ext/module/delegation, a NoMethodError is raised because
`delegate` remains undefined.
Without core_ext/class/attribute_acessors, an ArgumentError is raised because
`delegate` does not receive a value for its :to option.
2011-07-19 10:27:57 -03:00
Elliot Winkler
8ebd8416c4
ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL
2011-07-18 14:56:07 -06:00
Jon Leighton
312ee12403
Add autoload declaration for deprecated AssociationCollection
2011-07-18 11:58:56 +01:00
Prem Sichanugrist
b2cd66ff9c
Show a deprecation warning if user passing less number of argument in the dynamic finder
...
The previous behavior was unintentional, and some people was relying on it. In the next version of Rails, the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.) It will raise the ArgumentError otherwise.
2011-07-17 19:30:11 -04:00
Jon Leighton
fb95dee926
Deprecated the AssociationCollection constant
2011-07-16 14:22:34 +01:00
Evan Light
2cbac3c6f8
Closes #2065
...
Cache key was incorrectly using timezone-dependent record#updated_at when it should be using a timezone-independent value to generate the cache key
2011-07-15 22:11:03 -04:00
Santiago Pastorino
a91afeb42a
Merge pull request #2040 from SAP-Oxygen/3-1-stable-sqlbypass-patch
...
Fix for SqlBypass session store
2011-07-12 15:05:05 -07:00
Joseph Wong
b87f8d8635
Fix for SqlBypass session store
...
Two issues fixed:
1) connection_pool is not defined - needed by SessionStore#drop_table!
and create_table! since c94651f
2) initialization of connection to the default of AR::Base.connection
only occurred at the singleton level - the instance level method defined
by cattr_accessor did not have this logic
2011-07-12 11:01:56 -07:00
Joseph Wong
63fdd2c90a
Fixed session ID fixation for ActiveRecord::SessionStore
...
I have found that Rails will take an invalid session ID specified by the
client and materialize a session based on that session ID. This means
that it is possible, among other things, for a client to use an
arbitrarily weak session ID or for a client to resurrect a previous used
session ID. In other words, we cannot guarantee that all session IDs are
generated by the server and that they are (statistically) unique through
time.
The fix is to always generate a new session ID in #get_session if an
existing session cannot be found under the incoming session ID.
Also added new tests that make sure that an invalid session ID is never
materialized into a new session, regardless of whether it comes in via a
cookie or a URL parameter (when :cookie_only => false).
2011-07-12 10:57:20 -07:00
Jon Leighton
5c591e5c96
Fix exception if old and new targets are both nil. Fixes #1471 .
...
Conflicts:
activerecord/test/models/comment.rb
2011-07-12 00:16:44 +01:00
Santiago Pastorino
a7319a9af9
to_key on a destroyed model should return nil
2011-07-09 15:38:08 -03:00
Akira Matsuda
7f37ed0152
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 21:35:09 +09:00
Jon Leighton
ca94acf0be
Foo.joins(:bar).includes(:bar) should result in a single query with :bar as a join. Related: #1873 .
2011-07-09 11:39:38 +01:00
Akira Matsuda
3cb67e442f
find(:first) => first
2011-07-09 12:24:07 +02:00
Tomas D'Stefano
15f5c3bcbd
Destroy association habtm record before destroying the record itself. Fixes issue #402 .
2011-07-08 22:31:50 +01:00
Jon Leighton
6d2acc1195
Ensure that the foreign key gets set when doing record.create_association or record.create_association. Fixes #1960 .
2011-07-08 21:03:40 +01:00
Santiago Pastorino
d7be017c7e
Merge pull request #2002 from knapo/3-1-stable
...
Backport of #1997
2011-07-07 09:30:16 -07:00
knapo
7c051ab075
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 18:13:29 +02:00
Dmitriy Kiriyenko
fd8dbfa776
Add require ActiveSupport delegation to ActiveRecord::Relation class.
2011-07-07 17:09:03 +02:00
Santiago Pastorino
ec27814883
Merge pull request #1990 from simonbaird/3-1-stable
...
rake db:test:purge creates mysql database with wrong charset & collation (3-1-stable)
2011-07-06 20:10:17 -07:00
Jon Leighton
fe2167f3f1
Don't construct association scope in initializer. This yields a big performance gain for cases where the association is never used to load the target, for example with preloading. Related: #1873 .
2011-07-07 01:08:06 +01:00
Simon Baird
f44c3ea457
Fix charset/collate in mysql recreate_database
...
See new method mysql_creation_options. It is used by both
create_database and recreate_database so they are consistent.
(Manual cherry pick of 3ba3125b24 )
2011-07-07 09:43:16 +10:00
Santiago Pastorino
3a92bc7906
Merge pull request #1789 from grantneufeld/schema_column_exists_options_hash_3_1
...
Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists?
2011-07-06 12:00:35 -07:00
Santiago Pastorino
e7ac539c62
Merge pull request #1904 from oriolgual/1571_fix_for_3_1_stable
...
Fix #1571 for 3-1-stable
2011-07-06 11:57:36 -07:00