Commit Graph

3482 Commits

Author SHA1 Message Date
Aaron Patterson
2abaa19e77 Merge pull request #4856 from ihid/store_null_bug
Allow store to be a not null column.
2012-02-02 12:07:28 -08:00
Jeremy Walker
58d10e2012 Allow store to be a not null column. 2012-02-02 18:57:15 +00:00
Rafael Mendonça França
37ce852c51 columns method doesn't have name argument 2012-02-02 16:08:31 -02:00
Sebastian Martinez
dcd74eb519 Remove useless argument in #columns. 2012-02-02 10:34:17 -02:00
Jon Leighton
66fc1d6ac8 Merge pull request #4543 from jdelStrother/find_or_init
Don't instantiate two objects in collection proxy / find_or_instantiate_by
2012-02-01 15:15:29 -08:00
Rafael Mendonça França
9b1d54e292 Fix typo 2012-02-01 17:14:00 -02:00
Rafael Mendonça França
a73662f3d8 Use human attribute name to show the dependent destroy message 2012-02-01 17:03:15 -02:00
José Valim
403cce77f1 Merge pull request #4828 from railsaholic/fix_error_message
fix has_one, has_many restrict error message
2012-02-01 10:43:40 -08:00
Aaron Patterson
6da8ec14c5 Merge pull request #4806 from KL-7/do-not-serialize-nil
Do not serialize nil in serialized attribute.
2012-02-01 10:39:03 -08:00
Aaron Patterson
78d5d6f868 Merge pull request #4809 from cfeist/feist-sqlite-binary-corruption
Fix for SQLite binary data corrupter (to master branch)
2012-02-01 10:38:26 -08:00
Manoj
907d19343e fix has_one, has_many restrict error message 2012-02-01 23:58:20 +05:30
Vijay Dev
5850ea0560 fix a typo [ci skip] 2012-02-01 23:31:43 +05:30
Chris Feist
96359d557d Added test to illustrate bad binary blobs. 2012-01-31 13:45:00 -06:00
Aaron Patterson
c4469e6c39 Revert "Merge pull request #4746 from jenslukowski/issue4718"
This reverts commit 5cad7a0dba652f3e942e58087bc88ba5c5390edc, reversing
changes made to bb842e8d2111e50b21a14b8bd6d89371a4b9cd68.
2012-01-31 11:34:15 -08:00
Jon Leighton
75de1ce131 Merge pull request #4805 from xuanxu/none_and_null_object_pattern
Added `none` query method to return zero records.
2012-01-31 11:17:02 -08:00
Kirill Lashuk
39cb1bedb8 Do not serialize nil in serialized attribute. 2012-01-31 22:07:09 +03:00
Aaron Patterson
d9c48626f9 Merge pull request #4742 from petervandenabeele/master
Set the timezone correctly for a test in activerecord/../base_test.rb
2012-01-31 10:55:00 -08:00
Aaron Patterson
5cad7a0dba Merge pull request #4746 from jenslukowski/issue4718
Test and fix for issue 4718
2012-01-31 10:53:16 -08:00
Juanjo Bazán
8270e4a8ce Added none query method to return zero records.
And added NullRelation class implementing the null object pattern for the `Relation` class.
2012-01-31 19:50:09 +01:00
José Valim
3bf859daf6 Merge pull request #4791 from gregolsen/reflection_test_fixed
reflection test fixed
2012-01-31 08:45:01 -08:00
Rafael Mendonça França
f944d528c4 Remove deprecation warnings from tests 2012-01-31 14:22:58 -02:00
gregolsen
b00a5e6e51 test_get_ids_for_ordered_association fixed 2012-01-31 18:16:48 +02:00
gregolsen
58cd0085a9 reflection test fixed 2012-01-31 15:57:39 +02:00
Jon Leighton
98e1735d1d Merge pull request #4783 from gregolsen/ids_reader_fix
ids_reader method fixed, test added to has_many association (for PostgreSQL)
2012-01-31 05:47:41 -08:00
Jon Leighton
30a2328003 Merge pull request #4727 from railsaholic/dependent_restrict_should_add_error
has_many/has_one, :dependent => :restrict, deprecation added
2012-01-31 05:45:04 -08:00
gregolsen
f13a1dd781 ids_reader method fixed, test added to has_many association 2012-01-31 11:52:23 +02:00
Manoj
23074c81a5 suggested fixes for :dependent => :restrict deprecation. 2012-01-31 14:11:14 +05:30
kennyj
1a1d9e687a Fix GH #4754. Remove double-quote when using ANSI_QUOTES 2012-01-31 02:13:12 +09:00
Nathan Broadbent
b31eac5609 Replaced all 'for' loops with Enumerable#each 2012-01-30 03:15:49 +08:00
Peter Vandenabeele
7be0b7e59c Set default_timezone explicitly for a test in activerecord/../base_test.rb 2012-01-29 16:31:23 +01:00
Manoj
336ff8a97e has_many/has_one, :dependent => :restrict, deprecation added. 2012-01-29 15:28:22 +05:30
Jens Lukowski
4b96dd7962 failing test case for Issue 4718 2012-01-28 22:54:55 +01:00
Rafael Mendonça França
080bd83df9 Add create_join_table migration helper to create HABTM join tables 2012-01-27 15:34:53 -02:00
Paul McMahon
7b9baeed7c Fix regression from Rails 3.1
Under Rails 3.1, you were allowed to pass a hash to a find_or_create
method with multiple attribute names, but this was broken as the
arguments were being improperly validated.
2012-01-27 09:37:14 +09:00
Aaron Patterson
33fda1ca56 Merge pull request #4696 from rafaelfranca/issue-4653
Remove extra attributes from HABTM join tables in AR tests
2012-01-26 09:41:43 -08:00
Xavier Noria
f251437415 disable automatic explain if there is no logger [closes #4671] 2012-01-26 02:50:46 -08:00
Sergey Nartimov
6e46b3bc27 fix fixtures test as table_name is a string now 2012-01-26 11:10:52 +03:00
Sergey Nartimov
db48ee3847 call to_s on value passed to table_name= 2012-01-26 10:12:12 +03:00
Aaron Patterson
522c0fdb55 The primary key is always initialized in the @attributes hash to nil (unless
another value has been specified).
2012-01-25 14:42:22 -08:00
Paul Sadauskas
6cde635f34 Handle nil in add_index :length option in MySQL
Our schema.rb is being generated with an `add_index` line similar to this:

    add_index "foo", ["foo", "bar"], :name => "xxx", :length => {"foo"=>8, "bar=>nil}

This is the same as it was on Rails 3.1.3, however, now when that
schema.rb is evaluated, its generating bad SQL in MySQL:

    Mysql::Error: You have an error in your SQL syntax; check the manual
    that corresponds to your MySQL server version for the right syntax
    to use near '))' at line 1: CREATE UNIQUE INDEX
    `xxx` ON `foo` (`foo`(8), `bar`())

This commit adds a check for nil on the length attribute to prevent the
empty parens from being output.
2012-01-24 14:22:24 -07:00
Aaron Patterson
dcf0558ae5 Moving AR::TestCase in to the AR tests directory 2012-01-24 12:01:52 -08:00
Aaron Patterson
01176a7eaf Merge pull request #4558 from stephencelis/type-cast-unknown-should-fail
Don't type-cast unknown types to YAML.
2012-01-23 09:47:20 -08:00
Jari Jokinen
1e4168007c Fix typo 2012-01-22 09:00:08 +02:00
Akira Matsuda
bd60339963 change AR default_timezone to :utc since it's the default for AR::Railtie 2012-01-21 20:07:12 +09:00
Stephen Celis
920070e42b Don't type-cast unknown types to YAML. 2012-01-20 10:44:08 -08:00
Jon Leighton
30b0e5848c Fix another race condition.
From 2c667f69aa2daac5ee6c29ca9679616e2a71532a.

Thanks @pwnall for the heads-up.
2012-01-20 18:32:27 +00:00
Aaron Patterson
17064acb3e adding tests for previous_changes hash 2012-01-19 18:25:14 -08:00
Jonathan del Strother
ee2ae378cb Don't instantiate two objects in collection proxy / find_or_instantiator_by 2012-01-19 17:13:06 +00:00
Olek Janiszewski
7afbc89c37 Add ActiveRecord::Base#with_lock
Add a `with_lock` method to ActiveRecord objects, which starts
a transaction, locks the object (pessimistically) and yields to the block.
The method takes one (optional) parameter and passes it to `lock!`.

Before:

    class Order < ActiveRecord::Base
      def cancel!
        transaction do
          lock!
          # ... cancelling logic
        end
      end
    end

After:

    class Order < ActiveRecord::Base
      def cancel!
        with_lock do
          # ... cancelling logic
        end
      end
    end
2012-01-18 23:23:41 +01:00
Aaron Patterson
5f07953f36 Merge pull request #4487 from sarenji/fix-reset-counters
Fix bug where reset_counters resets the wrong counter cache.
2012-01-17 10:23:13 -08:00