Commit Graph

1106 Commits

Author SHA1 Message Date
Pratik Naik
ca9413674e Improve documentation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-26 12:27:52 +00:00
David Heinemeier Hansson
c10b2255b5 Fixed that ActiveRecord#Base.find_or_create/initialize would not honor attr_protected/accessible when used with a hash (closes #11422) [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9090 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-25 23:56:48 +00:00
David Heinemeier Hansson
c6f2af5c31 Added ActiveRecord#Base.all/first/last as aliases for find(:all/:first/:last) (closes #11413) [nkallen, thechrisoshow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 19:59:22 +00:00
Rick Olson
081ddb6f24 Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-24 02:50:02 +00:00
Rick Olson
273b21faa9 Add has_one :through support, finally. Closes #4756 [thechrisoshow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-21 18:09:03 +00:00
Jeremy Kemper
dfa6888311 Migrations: create_table supports primary_key_prefix_type. Closes #10314.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9056 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-18 18:23:14 +00:00
David Heinemeier Hansson
fbf41c72a9 Added logging for dependency load errors with fixtures (closes #11056) [stuthulhu]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9050 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 21:48:28 +00:00
Geoff Buesing
54ccdd3343 Time, DateTime and TimeWithZone #in_time_zone defaults to Time.zone. Removing now unneeded #in_current_time_zone. ActiveRecord time zone aware attributes updated to use #in_time_zone
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9047 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-17 05:50:13 +00:00
David Heinemeier Hansson
2c6e616b90 Fixed that scoped joins would not always be respected (closes #6821) [Theory/Danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 18:41:42 +00:00
Rick Olson
7750afc4c1 Ensure that ActiveRecord::Calculations disambiguates field names with the table name. Closes #11027 [cavalle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 03:06:51 +00:00
David Heinemeier Hansson
bcb47a843b Added add/remove_timestamps to the schema statements for adding the created_at/updated_at columns on existing tables (closes #11129) [jramirez]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9014 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-13 02:17:04 +00:00
David Heinemeier Hansson
d5a4d5abb4 Added ActiveRecord::Base.find(:last) (closes #11338) [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9012 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-12 21:26:02 +00:00
Geoff Buesing
8e21ec36cf test_native_types expects DateTime.local_offset instead of DateTime.now.offset; fixes test breakage due to dst transition
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9003 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-10 06:48:15 +00:00
Pratik Naik
e117350037 Add :readonly option to HasManyThrough associations. Closes #11156 [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-07 11:45:07 +00:00
Michael Koziarski
4ca170fcea Improve performance on :include/:conditions/:limit queries by selectively joining in the pre-query. Closes #9560 [dasil003]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8977 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-03 06:23:38 +00:00
Michael Koziarski
13a60b83a4 Improve performance by avoiding named block arguments. Closes #11109 [adymo]
Reapplies [8865] with some fixes


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8957 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-29 23:16:53 +00:00
Jeremy Kemper
9a947af0e7 PostgreSQL: support server versions 7.4 through 8.0 and the ruby-pg driver. Closes #11127
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8922 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-22 03:26:21 +00:00
Michael Koziarski
21c75e545a Ensure nested preloading works when associations return nil. Closes #11145 [GMFlash]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8894 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 04:49:56 +00:00
Michael Koziarski
f2546164d6 Make dynamic finders respect the :include on HasManyThrough associations. Closes #10998. [cpytel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-18 00:14:54 +00:00
Geoff Buesing
2920bd22df ActiveRecord::Base#instantiate_time_object only uses Time.zone when Base.time_zone_aware_attributes is true; leverages Time#time_with_datetime_fallback for readability
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8882 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-16 20:47:01 +00:00
Geoff Buesing
4e3ecec9c7 Refactor ActiveRecord::ConnectionAdapters::Column.new_time: leverage DateTime failover behavior of Time#time_with_datetime_fallback
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8881 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-16 20:13:38 +00:00
Jeremy Kemper
c55120c8e6 Revert [8865], broke AP record identifier. Reopens #11109.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-15 21:47:27 +00:00
Michael Koziarski
838b02450a Optimisation for BigDecimal conversion code. Closes #11110 [adymo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8870 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-14 20:06:25 +00:00
Rick Olson
de048b1009 Improve associations performance by using symbol callbacks instead of string callbacks. Closes #11108 [adymo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8867 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-14 07:53:37 +00:00
Rick Olson
8a2266c020 Improve associations performance by avoiding named block arguments. Closes #11109
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-14 07:24:09 +00:00
Jeremy Kemper
dfa786631b Introduce the :readonly option to all associations. Records from the association cannot be saved. Closes #11084.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-13 06:32:50 +00:00
Geoff Buesing
c9402b2277 Multiparameter attributes for time columns fail over to DateTime when out of range of Time
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8855 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-10 22:46:31 +00:00
Geoff Buesing
94fa9fb745 TimeZone#new renamed #local, so that new TimeWithZone instances can be created via Time.zone.local()
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-10 17:02:22 +00:00
Rick Olson
72385a7be6 Add Time Zone support to ActiveRecord, and config.time_zone property for specifying a default Time Zone. Closes #10982 [Geoff Buesing, rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-06 06:43:02 +00:00
Rick Olson
5ef2b089f0 Reshuffle load order so that routes and observers are initialized after plugins and app initializers. Closes #10980 [rick, fxn]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8787 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-02-02 20:18:18 +00:00
Jeremy Kemper
be827f9348 Fixed preloading belongs_to associations which reference a custom foreign key. References #9640.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-31 07:50:15 +00:00
Jeremy Kemper
e59978aa86 MySQL: omit text/blob defaults from the schema instead of using an empty string. Closes #10963.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8757 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-30 23:22:58 +00:00
Jeremy Kemper
16b129a68c belongs_to supports :dependent => :destroy and :delete. Closes #10592.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8675 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 05:30:42 +00:00
Jeremy Kemper
355a8ff2cd Introduce preload query strategy for eager :includes. Closes #9640.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8672 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 04:19:53 +00:00
Jeremy Kemper
abdf546ad6 Support aggregations in finder conditions. Closes #10572.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8671 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 03:45:24 +00:00
Jeremy Kemper
ddbaacfd4a Organize and clean up the Active Record test suite. Closes #10742.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8662 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:31:51 +00:00
Rick Olson
49794485b6 Ensure that modifying has_and_belongs_to_many actions clear the query cache. Closes #10840 [john.andrews]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8653 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 01:55:11 +00:00
Rick Olson
ebfd03b938 Fix issue where Table#references doesn't pass a :null option to a *_type attribute for polymorphic associations. Closes #10753 [railsjitsu]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8627 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-11 19:54:19 +00:00
Jeremy Kemper
8f7fa55e8d Fixtures: removed support for the ancient pre-YAML file format. Closes #10736.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8594 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-08 03:54:40 +00:00
Jeremy Kemper
ebe3a0d532 More thoroughly quote table names. Exposes some issues with sqlite2 adapter. Closes #10698.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8571 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 14:58:28 +00:00
Jeremy Kemper
c36f8111a6 pdate_all ignores scoped :order and :limit, so post.comments.update_all doesn't try to include the comment order in the update statement. Closes #10686.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8554 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-04 03:19:50 +00:00
David Heinemeier Hansson
2a9ad9ccbc Moved the caching stores from ActionController::Caching::Fragments::* to ActiveSupport::Cache::*. If you're explicitly referring to a store, like ActionController::Caching::Fragments::MemoryStore, you need to update that reference with ActiveSupport::Cache::MemoryStore [DHH] Deprecated ActionController::Base.fragment_cache_store for ActionController::Base.cache_store [DHH] All fragment cache keys are now by default prefixed with the 'views/' namespace [DHH] Added ActiveRecord::Base.cache_key to make it easier to cache Active Records in combination with the new ActiveSupport::Cache::* libraries [DHH] Added ActiveSupport::Gzip.decompress/compress(source) as an easy wrapper for Zlib [Tobias Luetke] Included MemCache-Client to make the improved ActiveSupport::Cache::MemCacheStore work out of the box [Bob Cottrell, Eric Hodel] Added config.cache_store to environment options to control the default cache store (default is FileStore if tmp/cache is present, otherwise MemoryStore is used) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8546 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-03 21:05:12 +00:00
Michael Koziarski
288553540b Ruby 1.9: Forwards compatibility change for fixtures and the new CSV module [JEG2]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8544 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-03 19:14:38 +00:00
David Heinemeier Hansson
424c330634 Added by parameter to increment, decrement, and their bang varieties so you can do player1.increment!(:points, 5) (closes #10542) [Sam]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8534 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-03 00:30:22 +00:00
Rick Olson
0ad24df6ed Optimize ActiveRecord::Base#exists? to use #select_all instead of #find. Closes #10605 [jamesh, fcheung, protocool]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8531 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-02 21:39:49 +00:00
Jeremy Kemper
4e04ec4adb Ruby 1.9 compat: fix two failing tests since String#each has been removed. Closes #10655.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8524 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-02 09:11:39 +00:00
Rick Olson
0e3a54a3b9 Don't unnecessarily load has_many associations in after_update callbacks. Closes #6822 [stopdropandrew, canadaduane]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-28 18:01:22 +00:00
Jeremy Kemper
f6379bfe15 Eager belongs_to :include infers the foreign key from the association name rather than the class name. Closes #10517.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8456 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-21 01:49:01 +00:00
Jeremy Kemper
b72763a96f SQLite: fix rename_ and remove_column for columns with unique indexes. Closes #10576.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8453 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-20 22:28:12 +00:00
Jeremy Kemper
b4e3b5d418 Ruby 1.9 compat: check column type more carefully
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8439 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-19 09:31:57 +00:00