Commit Graph

5378 Commits

Author SHA1 Message Date
Hendy Tanata
e149d5059b Improve doc for ActiveRecord::Base.unscoped. 2011-12-20 22:27:32 +05:30
David Heinemeier Hansson
9d6e52b55e Party like its R-C-UNO! 2011-12-19 18:34:57 -06:00
Juan M. Cuello
626c881863 Fix database tasks in test namespace.
This is mostly the same as 876bade599
that was reverted due to test failures, but now with a correction.
2011-12-19 18:20:17 -03:00
José Valim
3c1884e7dd Revert "Merge pull request #4030 from Juanmcuello/database_tasks"
This reverts commit a0edfb4d20, reversing
changes made to 4012fcff22.
2011-12-19 19:31:36 +01:00
Juan M. Cuello
876bade599 Fix database tasks in test namespace. 2011-12-19 13:52:27 -03:00
Vijay Dev
c59409b838 fix a minor typo 2011-12-19 01:31:12 +05:30
José Valim
e8d69437d4 Update activerecord/lib/active_record/railties/databases.rake 2011-12-18 20:56:59 +01:00
José Valim
81deb346af Merge pull request #4019 from kommen/rake_db_structure
Make structure.sql file configureable in db:structure:dump analog to SCHEMA in db:schema:dump
2011-12-18 11:54:11 -08:00
Dieter Komendera
a2249eee76 Rename STRUCTURE to DB_STRUCTURE, update dump task description and add simple testcase. 2011-12-18 20:43:36 +01:00
Jon Leighton
de2306f10c Merge pull request #4014 from lest/bypass-preloading-for-ids-reader
bypass preloading for ids_reader
2011-12-18 09:42:15 -08:00
Sergey Nartimov
109db5a550 bypass preloading for ids_reader
when fetching ids for a collection, bypass preloading
to avoid the unnecessary performance overhead
2011-12-18 10:59:24 +03:00
Sergey Nartimov
04cea56d89 call scope within unscoped to prevent duplication of where values 2011-12-17 14:41:17 +03:00
Xavier Noria
0065f37826 AS::Concern is not really needed for AR::Explain 2011-12-16 12:12:05 -08:00
Vijay Dev
bd84b2bb5d Merge branch 'master' of github.com:lifo/docrails 2011-12-16 23:34:00 +05:30
Dieter Komendera
aa92d3732c Make structure file configureable in db:structure:dump analog to SCHEMA in db:schema dump and clean up a bit. 2011-12-16 16:15:16 +01:00
Jon Leighton
eba581846e Fix the build on postgres. Note: we should probably actually make schema mutations bust the cache. 2011-12-16 14:51:22 +00:00
Jon Leighton
7b1eeea5bc Should clear the primary keys cache also 2011-12-16 13:52:07 +00:00
Jon Leighton
7f20bb995a Don't store defaults in the schema cache 2011-12-16 13:52:07 +00:00
Jon Leighton
dee94d8ab5 Defaults hash can go on the model 2011-12-16 13:52:07 +00:00
Jon Leighton
0b08ff7d92 Cache columns at the model level.
Allows two models to use the same table but have different primary keys.
2011-12-16 13:52:07 +00:00
José Valim
192e55c38e Do not raise an exception if an invalid route was generated automatically. 2011-12-16 10:45:59 +01:00
Jon Leighton
2b22564c4e Move DefaultScope and NamedScope under Scoping 2011-12-15 20:45:42 +00:00
Jon Leighton
17ad71e514 Let AttributeMethods do its own including etc 2011-12-15 20:45:42 +00:00
Jon Leighton
ceb33f8493 Split out most of the AR::Base code into separate modules 🍰 2011-12-15 20:45:37 +00: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
José Valim
1e8b751813 Make with_scope public so we stop using send 💣 2011-12-15 20:47:26 +01:00
José Valim
1af2a1d0f5 Improve delegate list to avoid method missing. 2011-12-15 20:01:56 +01:00
José Valim
283a087634 Clean up the cache before the request in case we are running in the reload_classes_only_on_change schema. 2011-12-15 18:48:10 +01:00
José Valim
de947c621d There isn't a column_hash. It was being invoked by method missing. 2011-12-15 17:09:48 +01:00
Jon Leighton
8dba32f125 Fix #3987. 2011-12-15 13:23:28 +00:00
Andrew Kaspick
774ff18c09 Allow nested attributes in associations to update values in it's owner object. Fixes a regression from 3.0.x 2011-12-14 20:13:03 -06:00
Jon Leighton
889e8bee82 Fix #3672 again (dependent: delete_all perf) 2011-12-14 19:20:19 +00:00
Jon Leighton
909b337da8 Don't try to autosave nested assocs. Fixes #2961. 2011-12-14 17:28:59 +00:00
Alexander
9e39dc48d6 Update activerecord/lib/active_record/reflection.rb 2011-12-14 20:53:39 +04:00
Jon Leighton
18bf30982b Cache column defaults on model. ~30% on Model.new due to avoiding repeatedly fetching connection. 2011-12-14 16:14:47 +00:00
Jon Leighton
7b0edbb9f2 Avoid super; speeds up Model.new by about 12% 2011-12-14 16:14:47 +00:00
Jon Leighton
19bea9f1bd Stop the build asploding on 1.8.7 2011-12-14 15:31:12 +00:00
Jon Leighton
bb44e5a80a Use a separate module for 'external' attribute methods. 2011-12-14 14:51:57 +00:00
Jon Leighton
38703ac897 Revert naive O(1) table_exists? implementation.
It was a bad idea to rescue exceptions here. This can interfere with
transaction rollbacks which seems to be the cause of current CI
failure.

Instead, each adapter should implement its own DB-specific O(1)
implementation, and we fall back on the generic, slower, implementation
otherwise.
2011-12-13 23:46:26 +00:00
Vijay Dev
74e46e5156 Merge branch 'master' of github.com:lifo/docrails 2011-12-14 02:13:23 +05:30
José Valim
80256abb39 FileUpdateChecker should be able to handle deleted files. 2011-12-13 11:23:21 +01:00
Aaron Patterson
d12e6d0e2f use the schema cache when asking for the primary key 2011-12-12 15:59:44 -08:00
José Valim
fa1d9a884c Speed up development by only reloading classes if dependencies files changed.
This can be turned off by setting `config.reload_classes_only_on_change` to false.

Extensions like Active Record should add their respective files like db/schema.rb and db/structure.sql to `config.watchable_files` if they want their changes to affect classes reloading.

Thanks to https://github.com/paneq/active_reload and Pastorino for the inspiration. <3
2011-12-12 22:54:04 +01:00
clst
2be6df693a changed :finder_sql example to select *
because with select p.* you can no longer use count(). Using count will result in an SQL error message.
2011-12-12 18:27:51 +01:00
clst
a6b15bd2dc fixed example for :finder_sql
people.* will not work when the alias is named p
2011-12-12 15:46:42 +01:00
Aaron Patterson
d102791df7 ensure @fixture_connections is initialized in case an exception happens during setup 2011-12-10 16:33:08 -08:00
Aaron Patterson
d09b67cfc0 Errno::ENOENT error makes more sense when a file cannot be found 2011-12-10 16:32:07 -08:00
Piotr Sarnacki
35a1744a45 Allow to run migrations with given scope, with SCOPE=<scope>
Scope in migrations can be defined by adding suffix in filename,
like: 01_a_migration.blog.rb. Such migration have blog scope.

Scope is automatically added while copying migrations from engine,
so if you want to revert all of the migrations from given engine,
you can just run db:migrate with SCOPE, like:

    rake db:migrate SCOPE=blog
2011-12-09 22:00:51 +01:00
Piotr Sarnacki
f0b782d060 Allow to filter migrations by passing a block
Example:
  ActiveRecord::Migrator.migrate(path) do |migration|
    migration.name =~ /User/
  end

The above example will migrate only migrations with User in
the name
2011-12-09 21:43:36 +01:00