Commit Graph

1115 Commits

Author SHA1 Message Date
Carlos Antonio da Silva
f4fbc03010 Remove support for the protected attributes gem
Related to #10690.
2015-01-09 22:42:29 -02:00
Prathamesh Sonpatki
0e3eca8a93 Fixed typos and wording in ActiveRecord CHANGELOG [ci skip] 2015-01-06 18:39:58 +05:30
Yves Senn
dd54b518ce Merge pull request #18358 from prathamesh-sonpatki/add-test-for-non-string-labeled-fixtures
Fix lookup of fixtures with non-string(like Fixnum) label
2015-01-06 13:31:50 +01:00
Prathamesh Sonpatki
8da936a5d3 Fix lookup of fixtures with non-string label
- Fixtures with non-string labels such as integers should be accessed
   using integer label as key. For eg. pirates(1) or pirates(42).
 - But this results in NotFound error because the label is converted into string before
   looking up into the fixtures hash.
 - After this commit, the label is converted into string only if its a
   symbol.
 - This issue was fount out while adding a test case for
   https://github.com/rails/rails/commit/7b910917.
2015-01-06 17:15:39 +05:30
Carlos Antonio da Silva
e50064c130 Fix typo in changelog [ci skip] 2015-01-05 08:49:02 -02:00
Yves Senn
4ed97979d1 remove deprecated support to preload instance-dependent associaitons.
Addresses ed56e596a0 (commitcomment-9145960)
2015-01-05 11:44:14 +01:00
Yves Senn
a076256d63 remove deprecated support for PG ranges with exclusive lower bounds.
addresses 91949e48cf (commitcomment-9144563)
2015-01-05 11:09:29 +01:00
Yves Senn
3ae9818143 remove deprecation warning when modifying a Relation with cached arel.
This adresses 1b7aa62b18 (commitcomment-9147803)
2015-01-05 10:08:56 +01:00
Yves Senn
65520c29f7 add punctuation. [ci skip] 2015-01-05 09:16:40 +01:00
robertomiranda
5a58ba3366 Add has_secure_token to Active Record
Update SecureToken Docs

Add Changelog entry for has_secure_token [ci skip]
2015-01-04 11:31:37 -05:00
Rafael Mendonça França
a502703c3d Change the behavior of boolean columns to be closer to Ruby's semantics.
Before this change we had a small set of "truthy", and all others
are "falsy".

Now, we have a small set of "falsy" values and all others are
"truthy" matching Ruby's semantics.
2015-01-04 11:58:44 -03:00
Rafael Mendonça França
07d3d40234 Change transaction callbacks to not swallowing errors.
Before this change any error raised inside a transaction callback
are rescued and printed in the logs.

Now these errors are not rescue anymore and just bubble up,
as the other callbacks.
2015-01-04 11:58:44 -03:00
Rafael Mendonça França
3a59dd2123 Remove deprecated sanitize_sql_hash_for_conditions 2015-01-04 11:58:44 -03:00
Rafael Mendonça França
ede8c199a8 Remove deprecated Reflection#source_macro 2015-01-04 11:58:44 -03:00
Rafael Mendonça França
9013e28e52 Remove deprecated symbolized_base_class and symbolized_sti_name 2015-01-04 11:58:44 -03:00
Rafael Mendonça França
0fbd1fc888 Remove deprecated ActiveRecord::Base.disable_implicit_join_references= 2015-01-04 11:58:44 -03:00
Rafael Mendonça França
efdc20f36c Remove deprecated access to connection specification using a string acessor.
Now all strings will be handled as a URL.
2015-01-04 11:58:43 -03:00
Rafael Mendonça França
a939506f29 Change the default null value for timestamps to false 2015-01-04 11:58:43 -03:00
Rafael Mendonça França
94c87156fd Return an array of pools from connection_pools 2015-01-04 11:58:43 -03:00
Rafael Mendonça França
634ecdbf1b Return a null column from column_for_attribute when no column exists.
This reverts commit ae96f229f6501d8635811d6b22d75d43cdb880a4.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/attribute_methods.rb
2015-01-04 11:58:43 -03:00
Rafael Mendonça França
82043ab53c Remove deprecated serialized_attributes 2015-01-04 11:58:43 -03:00
Rafael Mendonça França
87c8ce340c Remove deprecated automatic counter caches on has_many :through 2015-01-04 11:58:43 -03:00
claudiob
9c65c539e2 Add config to halt callback chain on return false
This stems from [a comment](rails#17227 (comment)) by @dhh.
In summary:

* New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
* Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.

For this purpose, this commit introduces a Rails configuration option:

```ruby
config.active_support.halt_callback_chains_on_return_false
```

For new Rails 5.0 apps, this option will be set to `false` by a new initializer
`config/initializers/callback_terminator.rb`:

```ruby
Rails.application.config.active_support.halt_callback_chains_on_return_false = false
```

For existing apps ported to Rails 5.0, the initializers above will not exist.
Even running `rake rails:update` will not create this initializer.

Since the default value of `halt_callback_chains_on_return_false` is set to
`true`, these apps will still accept `return true` as a way to halt callback
chains, displaying a deprecation warning.

Developers will be able to switch to the new behavior (and stop the warning)
by manually adding the line above to their `config/application.rb`.

A gist with the suggested release notes to add to Rails 5.0 after this
commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931
2015-01-02 15:31:56 -08:00
claudiob
bb78af73ab Deprecate false as the way to halt AR callbacks
Before this commit, returning `false` in an ActiveRecord `before_` callback
such as `before_create` would halt the callback chain.

After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.

The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
2015-01-02 15:31:56 -08:00
Rafael Mendonça França
dbe7fe289c Merge pull request #17820 from fw42/restore_query_cache_on_rollback
Clear query cache on rollback
2015-01-02 14:36:23 -03:00
Rafael Mendonça França
ecdae459d2 Merge pull request #15309 from iantropov/issue_12698_build_through
Add setting of FK for throgh associations while building

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/has_many_through_associations_test.rb
2015-01-02 14:29:07 -03:00
Rafael Mendonça França
a908e01ac0 Merge pull request #18228 from kamipo/correctly_dump_primary_key
Improve a dump of the primary key support.

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 13:37:26 -03:00
Rafael Mendonça França
acb1991910 Merge pull request #18067 from kamipo/format_datetime_string_according_to_precision
Format the datetime string according to the precision of the datetime field.

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 11:17:55 -03:00
Rafael Mendonça França
bed2bdb17c Merge pull request #15746 from amccloud/auto-inverse_of-in-module
Fixed automatic inverse_of for models nested in module

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 11:06:17 -03:00
Rafael Mendonça França
9598c9655f Merge pull request #11898 from prathamesh-sonpatki/patch-update
Changed ActiveRecord::Relation#update behavior so that it will work on Relation objects without giving id

Conflicts:
	activerecord/CHANGELOG.md
2015-01-02 10:48:48 -03:00
Ryuta Kamizono
4157f5d172 Format the datetime string according to the precision of the datetime field.
Incompatible to rounding behavior between MySQL 5.6 and earlier.

In 5.5, when you insert `2014-08-17 12:30:00.999999` the fractional part
is ignored. In 5.6, it's rounded to `2014-08-17 12:30:01`:

http://bugs.mysql.com/bug.php?id=68760
2015-01-02 22:30:07 +09:00
Ryuta Kamizono
ae419af666 Allow precision option for MySQL datetimes. 2015-01-02 22:30:07 +09:00
Rafael Mendonça França
70c2777d1c Merge pull request #18080 from korbin/fix_reaping_frequency_configuration
Fix issue with reaping_frequency type.
2015-01-02 01:37:07 -03:00
Rafael Mendonça França
04852b875e Fix error message when trying to create an associated record
This error only happens when the foreign key is missing.

Before this fix the following exception was being raised:

    NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218>

Now the message is:

    ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
2014-12-30 21:02:46 -03:00
Prathamesh Sonpatki
e2fcaf804f Update CHANGELOG entry for #18070 [ci skip]
- Improved wording of CHANGELOG entry for 5acd24bbea.
2014-12-31 00:07:22 +05:30
Arthur Neves
5acd24bbea
Ensures that primary_key method will return nil when multi-pk
When table has a composite primary key, the `primary_key` method for
sqlite3 and postgresql was only returning the first field of the key.

Ensures that it will return nil instead, as AR dont support composite pks.
2014-12-30 12:36:37 -05:00
Yves Senn
2b12288139 AR specific length validator to respect marked_for_destruction.
Closes #7247.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/models/owner.rb
2014-12-30 10:25:58 +01:00
Sean Griffin
fb14aa0c1b Ensure first! and friends work on loaded associations
Fixes #18237
2014-12-29 11:56:37 -07:00
Takashi Kokubun
068160b444 eager_load preserves readonly flag for associations 2014-12-30 01:07:33 +09:00
Ryuta Kamizono
3628025c0d Improve a dump of the primary key support.
If it is not a default primary key, correctly dump the type and options.
2014-12-29 09:19:21 +09:00
Yves Senn
ed7196645c docs, cleanup Active Record CHANGELOG. [ci skip] 2014-12-28 22:25:42 +01:00
Dan Olson
e780e2fda3 Provide :touch option to save() to accommodate saving without updating timestamps. [#18202] 2014-12-27 22:22:37 -06:00
Sean Griffin
307ec3db0f Provide a better error message for unsupported classes in serialize
We only support classes which provide a no-args constructor to use as a
default value. We can provide a more helpful error message if we catch
this when `serialize` is called, rather than letting it error when you
try to assign the attribute.

Fixes #18224
2014-12-27 19:49:09 -07:00
Ryuta Kamizono
a327a9dc58 Add bigint primary key support for MySQL.
Example:

    create_table :foos, id: :bigint do |t|
    end
2014-12-28 05:35:03 +09:00
Ryuta Kamizono
3cbfba6881 Support for any type primary key. 2014-12-28 05:35:03 +09:00
Ryuta Kamizono
9b3e7b396e Dump the default nil for PostgreSQL UUID primary key. 2014-12-26 17:54:08 +09:00
Sean Griffin
e550bbf8fc Changelog for 99a6f9e60ea55924b44f894a16f8de0162cf2702
Here you go, @senny. 😁
2014-12-23 07:21:43 -07:00
Sean Griffin
a054269ff8 Merge Pull Request #18157
Conflicts:
	activerecord/CHANGELOG.md
2014-12-23 07:13:54 -07:00
Yves Senn
ad783136d7 Replace deprecated #load_schema with #load_schema_for. 2014-12-23 12:07:15 +01:00
Yves Senn
0587070391 cleanup CHANGELOGs. [ci skip] 2014-12-23 08:56:17 +01:00