Jared Mehle
80e0cd3290
Quoted path to <Rails.env>_structure.sql file in db:test:clone_structure task.
...
Leaving the path unquoted causes errors in paths containing spaces or dashes.
2011-10-03 14:50:40 -05:00
Jon Leighton
adb8ac153f
Don't call self.class unless necessary. Closes #3171 .
2011-09-29 18:00:30 +01:00
Vijay Dev
33b55cfbdb
Merge branch 'master' of github.com:lifo/docrails
2011-09-28 00:04:45 +05:30
Diego Plentz
aafd4c0452
fixing docs for delete_sql where quotes should be used in this example.
2011-09-26 20:06:17 -03:00
Jon Leighton
b3407c86cf
Don't require a DB connection when setting primary key.
...
Closes #2807 .
2011-09-26 18:15:09 +01:00
Jon Leighton
89e98e278a
Merge pull request #3030 from htanata/fix_habtm_select_query_method
...
Fix: habtm doesn't respect select query method
2011-09-26 16:52:23 +01:00
Jon Leighton
3b87c38d02
Fix belongs_to polymorphic with custom primary key on target.
...
Closes #3104 .
2011-09-26 15:42:34 +01:00
Jon Leighton
b838059817
CollectionProxy#replace should change the DB records rather than just mutating the array. Fixes #3020 .
2011-09-26 10:41:58 +01:00
Vijay Dev
caa95ab6d8
Merge branch 'master' of github.com:lifo/docrails
2011-09-21 19:35:09 +05:30
Vijay Dev
ed1ada84ac
copy edits 908f2616
2011-09-20 19:46:59 +05:30
José Valim
51bef9d8fb
to_xml should also rely on serializable hash.
2011-09-18 09:09:01 -07:00
Ryan Bigg
908f2616d5
Document ActiveRecord::QueryMethods#select
2011-09-17 16:08:58 -07:00
Vijay Dev
49476eee78
Merge branch 'master' of github.com:lifo/docrails
2011-09-15 00:32:52 +05:30
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
3b8a7cf2a7
Stop trying to be clever about when to define attribute methods.
...
There is no meaningful performance penalty in defining attribute
methods, since it only happens once.
There is also no reason *not* to define them, since they get thrown in
an included module, so they will not 'overwrite' anything. In fact, this
is desirable, since it allows us to call super.
2011-09-14 00:00:37 +01:00
Jon Leighton
55da28dd2f
We don't need to build a set for DangerousAttributeError.
...
We can just use method_defined? and private_method_defined?
2011-09-14 00:00:37 +01:00
Erik Behrends
3777d4217b
[:class_name] option in belongs_to should mention belongs_to and not has_one
2011-09-13 22:42:39 +03:00
Jon Leighton
11870117c6
Rename first_or_new to first_or_initialize.
...
For consistency with find_or_initialize_by. Also remove first_or_build
alias.
2011-09-13 19:09:01 +01:00
Jon Leighton
1a421ceccb
Deprecate using method_missing for attributes that are columns.
...
This shouldn't ever happen unless people are doing something
particularly weird, but adding a deprecation in case there are bugs not
caught by our tests.
2011-09-13 00:03:09 +01:00
Jon Leighton
ac687ed651
Let Ruby deal with method visibility.
...
Check respond_to_without_attributes? in method_missing. If there is any
method that responds (even private), let super handle it and raise
NoMethodError if necessary.
2011-09-13 00:01:58 +01:00
Jon Leighton
eecfa84a90
Always generate attribute methods on the base class.
...
This fixes a situation I encountered where a subclass would cache the
name of a generated attribute method in @_defined_class_methods. Then,
when the superclass has it's attribute methods undefined, the subclass
would always have to dispatch through method_missing, because the
presence of the attribute in @_defined_class_methods would mean that it
is never generated again, even if undefine_attribute_methods is called
on the subclass.
There various other confusing edge cases like this. STI classes share
columns, so let's just keep all the attribute method generation state
isolated to the base class.
2011-09-13 00:01:58 +01:00
Jon Leighton
50d395f96e
Raise error when using write_attribute with a non-existent attribute.
...
Previously we would just silently write the attribute. This can lead to
subtle bugs (for example, see the change in AutosaveAssociation where a
through association would wrongly gain an attribute.
Also, ensuring that we never gain any new attributes after
initialization will allow me to reduce our dependence on method_missing.
2011-09-13 00:01:58 +01:00
Jon Leighton
3386a089ef
Fix warnings.
...
Make sure we don't redefine an already-defined attribute method.
2011-09-13 00:01:57 +01:00
Jon Leighton
99bd6b53da
Add deprecation for doing attribute_method_suffix ''
2011-09-13 00:01:57 +01:00
Jon Leighton
8d59e0b263
Alias id= if necessary, rather than relying on method_missing
2011-09-13 00:01:57 +01:00
Santiago Pastorino
4bcacc8066
Merge pull request #2936 from joelmoss/migration_status
...
db:migrate:status not looking at all migration paths
2011-09-11 17:06:21 -07:00
Jon Leighton
cbf1dc7842
Merge pull request #2757 from andmej/first_or_create_pull_request
...
Add first_or_create family of methods to Active Record
2011-09-08 15:07:23 -07:00
Aaron Patterson
e1b500ec96
LRU cache in mysql and sqlite are now per-process caches.
2011-09-07 15:26:47 -07:00
Aaron Patterson
834d429e84
LRU should cache per process in postgresql. fixes #1339
2011-09-07 15:26:47 -07:00
Aaron Patterson
b9f66f4db1
fixing view queries
2011-09-07 10:44:51 -07:00
Aaron Patterson
d9a20711da
use the supplied bind values
2011-09-07 10:44:51 -07:00
Aaron Patterson
f5ea24b3db
Merge commit 'refs/pull/2909/head' of https://github.com/rails/rails into rawr
...
* https://github.com/rails/rails :
Postgresql adapter: added current_schema check for table_exists?
Postgresql adapter: added current_schema check for table_exists?
2011-09-07 10:44:50 -07:00
Jon Leighton
143769051b
Don't include any of includes, preload, joins, eager_load in the through association scope.
2011-09-07 09:27:41 +01: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
Aaron Patterson
4edf6ea0ea
Merge pull request #2897 from rsutphin/ar31-remove_connection
...
Patch for issue #2820
2011-09-06 17:43:58 -07:00
Aaron Patterson
54b7e783ef
Database adapters use a statement pool.
...
Database adapters use a statement pool for limiting the number of open
prepared statments on the database. The limit defaults to 1000, but can
be adjusted in your database config by changing 'statement_limit'.
2011-09-06 16:47:34 -07:00
Aaron Patterson
a4fa6eab39
adding a statement pool for mysql and sqlite3
2011-09-06 16:06:27 -07:00
Jon Leighton
9bde73ff72
Nested through associations: preloads from the default scope of a through model should not be included in the association scope. (We're already excluding includes.) Fixes #2834 .
2011-09-06 16:34:32 +01:00
Jon Leighton
b24d668859
Ensure we are not comparing a string with a symbol in HasManyAssociation#inverse_updates_counter_cache?. Fixes #2755 , where a counter cache could be decremented twice as far as it was supposed to be.
2011-09-06 15:58:07 +01:00
Jon Leighton
9f3e732e65
Make the logic easier to read
2011-09-06 12:59:11 +01:00
Andrés Mejía
72317883ed
Using more precise method signatures for AR::Relation#first_or_create family of methods.
2011-09-06 02:45:54 -05:00
Andrés Mejía
d03aff7f64
Adding first example with no arguments to AR::Relation#first_or_create and removing examples that create several users at the same time (this is confusing and not really helpful).
2011-09-06 02:02:28 -05:00
Aaron Patterson
6d93f70c58
Merge pull request #2716 from jbbarth/fix_invert_rename_index
...
Fix bad options order in AR::Migration::CommandRecorder#invert_rename_index
2011-09-05 14:17:55 -07:00
Georg Friedrich
2175012230
Don't find belongs_to target when the foreign_key is NULL. Fixes #2828
2011-09-05 13:49:29 -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
Xavier Noria
0a38e2a5ce
restores the API docs of AR::Fixtures, made a quick pass over them, revises link in fixture template [ closes #2840 ]
2011-09-03 15:20:30 -07:00