- 27 2月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
Various behaviors needed by associations (such as creating the through record) are lost when `where` is called, since we stop having a `CollectionProxy` and start having an `AssociationRelation` which does not contain this behavior. I *think* we should be able to rm `AssociationRelation`, but we have tests saying the changes required to do that would be bad (Without saying why. Of course. >_>) Fixes #19073.
-
- 26 2月, 2015 1 次提交
-
-
由 Ryuta Kamizono 提交于
MySQL unicode support is not only `utf8mb4`. Then, The index length problem is not only `utf8mb4`. http://dev.mysql.com/doc/refman/5.6/en/charset-unicode.html SELECT * FROM information_schema.character_sets WHERE maxlen > 3; +--------------------+----------------------+------------------+--------+ | CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN | +--------------------+----------------------+------------------+--------+ | utf8mb4 | utf8mb4_general_ci | UTF-8 Unicode | 4 | | utf16 | utf16_general_ci | UTF-16 Unicode | 4 | | utf16le | utf16le_general_ci | UTF-16LE Unicode | 4 | | utf32 | utf32_general_ci | UTF-32 Unicode | 4 | +--------------------+----------------------+------------------+--------+
-
- 25 2月, 2015 1 次提交
-
-
由 Yves Senn 提交于
[Toby Ovod-Everett & Andrey Nering & Yves Senn] Closes #17726. Closes #10939. This patch makes three distinct modifications: 1. no longer fall back to disabling user triggers if system triggers can't be disabled 2. warn the user when referential integrity can't be disabled 3. restore aborted transactions when referential integrity can't be disabled The motivation behind these changes is to make the behavior of Rails transparent and less error-prone. To require superuser privileges is not optimal but it's what Rails currently needs. Users who absolutely rely on disabling user triggers can patch `disable_referential_integrity`. We should investigate `SET CONSTRAINTS` as a possible solution which does not require superuser privileges. /cc @matthewd
-
- 24 2月, 2015 1 次提交
-
-
由 Ryuta Kamizono 提交于
Example: create_table :foos, id: :primary_key, limit: 8 do |t| end # or create_table :foos, id: false do |t| t.column :id, limit: 8 end
-
- 23 2月, 2015 1 次提交
-
-
由 Yves Senn 提交于
-
- 22 2月, 2015 1 次提交
-
-
由 Josef Šimánek 提交于
Deprecate `required` option in favor of `optional` for belongs_to.
-
- 20 2月, 2015 2 次提交
-
-
由 Ryuta Kamizono 提交于
It is also necessary to format a time column like a datetime column.
-
由 Ryuta Kamizono 提交于
-
- 19 2月, 2015 2 次提交
-
-
由 Rafael Mendonça França 提交于
[ci skip]
-
由 Michael Ryan 提交于
-
- 18 2月, 2015 2 次提交
-
-
由 Hyonjee Joo 提交于
Fixes #18905. `#touch` now takes time as an option. Setting the option saves the record with the updated_at/on attributes set to the current time or the time specified. Updated tests and documentation accordingly.
-
由 Sean Griffin 提交于
This reverts commit 1502caef. The test suite for the mysql adapter broke when this commit was used with MySQL 5.6. Conflicts: activerecord/CHANGELOG.md
-
- 17 2月, 2015 1 次提交
-
-
由 Vipul A M 提交于
Deprecated passing of `start` value to `find_in_batches` and `find_each` in favour of `begin_at` value.
-
- 13 2月, 2015 3 次提交
-
-
由 Yves Senn 提交于
`has_secure_token` hasen't been released yet. No need to track every change in the CHANGELOG.
-
由 Wojciech Wnętrzak 提交于
``` user = User.create(token: "custom-secure-token") user.token # => "custom-secure-token" ```
-
由 Eugene Gilburg 提交于
Use SQL COUNT and LIMIT 1 queries for none? and one? methods if no block or limit is given, instead of loading the entire collection to memory. The any? and many? methods already follow this behavior. [Eugene Gilburg & Rafael Mendonça França]
-
- 12 2月, 2015 3 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Sean Griffin 提交于
In addition to cleaning up the implementation, this allows type casting behavior to be applied consistently everywhere. (#where for example). A good example of this was the previous need for handling value to key conversion in the setter, because the number had to be passed to `where` directly. This is no longer required, since we can just pass the string along to where. (It's left around for backwards compat) Fixes #18387
-
由 Sean Griffin 提交于
It looks like the only reason `current_scope` was thread local on `base_class` instead of `self` is to ensure that when we call a named scope created with a proc on the parent class, it correctly uses the default scope of the subclass. The reason this wasn't happening was because the proc captured `self` as the parent class, and we're not actually defining a real method. Using `instance_exec` fixes the problem. Fixes #18806
-
- 11 2月, 2015 2 次提交
-
-
由 Yves Senn 提交于
MySQL rejects to remove an index which is used in a foreign key constraint: ``` ActiveRecord::StatementInvalid: Mysql2::Error: Cannot drop index 'index_copies_on_title_id': needed in a foreign key constraint: ALTER TABLE `copies` DROP `title_id` ``` Removing the constraint before removing the column (and the index) solves this problem.
-
由 Prathamesh Sonpatki 提交于
-
- 09 2月, 2015 1 次提交
-
-
由 Vipul A M 提交于
that complements the `start`parameter to specify where to stop batch processing
-
- 08 2月, 2015 2 次提交
-
-
由 Ryuta Kamizono 提交于
If timestamp column have the precision, it need to format according to the precision of timestamp column.
-
由 Ryuta Kamizono 提交于
The charset of `version` column in `schema_migrations` table is depend on the database default charset and collation rather than the encoding of the connection.
-
- 07 2月, 2015 1 次提交
-
-
由 Rafael Mendonça França 提交于
nil or false should not be valid argument to the merge method. Closes #12264
-
- 04 2月, 2015 3 次提交
-
-
由 Sean Griffin 提交于
While we query the proper columns, we go through normal handling for converting the value to a primitive which assumes it should use the table's primary key. If the association specifies a different value (and we know that we're working with an association), we should use the custom primary key instead. Fixes #18813.
-
由 Miklos Fazekas 提交于
When ```becomes``` changes @attributes it should also change @changed_attributes. Otherwise we'll experience a kind of split head situation where attributes are coming from ```self```, but changed_attributes is coming from ```klass.new```. This affects the inheritance_colmn as it's changed by new for example. Fixes #16881
-
由 Sean Griffin 提交于
The cache name should be converted to a string when given, not compared as a symbol. This edge case is already adequately covered by our tests, but was masked by another issue where we were incorrectly updating the counter cache twice. When paired with a bug where we didn't update the counter cache because we couldn't find a match with the name, this made it look like everything was working fine. Fixes #10865.
-
- 03 2月, 2015 1 次提交
-
-
由 Chris Sinjakli 提交于
-
- 02 2月, 2015 1 次提交
-
-
由 eileencodes 提交于
Fixes #17621. This 5 year old (or older) issue causes validations to fire when a parent record has `validate: false` option and a child record is saved. It's not the responsibility of the model to validate an associated object unless the object was created or modified by the parent. Clean up tests related to validations `assert_nothing_raised` is not benefiting us in these tests Corrected spelling of "respects" It's better to use `assert_not_operator` over `assert !r.valid`
-
- 01 2月, 2015 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
The new association error belongs to Active Record, not Active Model. See #18700 for reference.
-
- 31 1月, 2015 1 次提交
-
-
由 Yves Senn 提交于
-
- 29 1月, 2015 3 次提交
-
-
由 Bogdan Gusiev 提交于
-
由 Matthew Draper 提交于
Post.where('id = 1').or(Post.where('id = 2')) # => SELECT * FROM posts WHERE (id = 1) OR (id = 2) [Matthew Draper & Gael Muller]
-
由 Sean Griffin 提交于
These callbacks will already have been defined when the association was built. The check against `reflection.autosave` happens at call time, not at define time, so simply modifying the reflection is sufficient. Fixes #18704
-
- 24 1月, 2015 3 次提交
-
-
由 Sean Griffin 提交于
Given that this was originally added to normalize an error that would have otherwise come from the database (inconsistently), it's more natural for us to raise in `type_cast_for_database`, rather than `type_cast_from_user`. This way, things like numericality validators can handle it instead if the user chooses to do so. It also fixes an issue where assigning an out of range value would make it impossible to assign a new value later. This fixes several vague issues, none of which were ever directly reported, so I have no issue number to give. Places it was mentioned which I can remember: - https://github.com/thoughtbot/shoulda-matchers/blob/9ba21381d7caf045053a81f32df7de2f49687820/lib/shoulda/matchers/active_model/allow_value_matcher.rb#L261-L263 - https://github.com/rails/rails/issues/18653#issuecomment-71197026
-
由 Sean Griffin 提交于
Fixes #18580.
-
由 Sean Griffin 提交于
Fixes #18632
-
- 22 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629.
-
- 21 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
This method can be used to see all of the fields on a model which have been read. This can be useful during development mode to quickly find out which fields need to be selected. For performance critical pages, if you are not using all of the fields of a database, an easy performance win is only selecting the fields which you need. By calling this method at the end of a controller action, it's easy to determine which fields need to be selected. While writing this, I also noticed a place for an easy performance win internally which I had been wanting to introduce. You cannot mutate a field which you have not read. Therefore, we can skip the calculation of in place changes if we have never read from the field. This can significantly speed up methods like `#changed?` if any of the fields have an expensive mutable type (like `serialize`) ``` Calculating ------------------------------------- #changed? with serialized column (before) 391.000 i/100ms #changed? with serialized column (after) 1.514k i/100ms ------------------------------------------------- #changed? with serialized column (before) 4.243k (± 3.7%) i/s - 21.505k #changed? with serialized column (after) 16.789k (± 3.2%) i/s - 84.784k ```
-