- 14 6月, 2014 8 次提交
-
-
由 Zachary Scott 提交于
-
由 Zachary Scott 提交于
variables [ci skip] Thanks to @matthewd for the excellent feedback!
❤ -
由 Sean Griffin 提交于
We don't generally modify our classes at runtime like this. Let's create the instance after the class is created. Original commit doesn't imply that this was intentional behavior.
-
由 Rafael Mendonça França 提交于
This partially reverts commit 1a203d5e. Reason: It was committed by accident
-
由 Zachary Scott 提交于
-
由 Zachary Scott 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
-
- 13 6月, 2014 6 次提交
-
-
由 Sean Griffin 提交于
We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
-
由 Sean Griffin 提交于
We'd spend a lot of time calling `hash` and `eql?` on the join model, which has no primary key. Calling `id` with no primary key is a really slow way to get back `nil`, so we can improve the performance there. However, even with the escape clause, we *still* weren't getting high enough performance, as we were checking the primary key too much. `hash` will always return `nil.hash` for records with no id, and `==` will always return `false`. We can optimize those cases in the HABTM join model.
-
由 Sean Griffin 提交于
Topics call `serialize :content`, which means that the values in the database should be YAML encoded, and we would only expect to receive YAML strings to `update_column` and `update_columns`.
-
- 12 6月, 2014 3 次提交
-
-
由 Wojciech Wnętrzak 提交于
Additionally: * It changes `purge` task on `sqlite3` adapter to recreate database file, to be consistent with other adapters. * Adds `purge` step when loading from `schema.rb`
-
由 Sean Griffin 提交于
The column name given by the adapter doesn't include the table namespace, so going through the hashed version of the result set causes overridden keys. Fixes #15649
-
由 Sean Griffin 提交于
We're not longer using `ipaddr` in schema dumper
-
- 11 6月, 2014 9 次提交
-
-
由 Arthur Neves 提交于
-
由 Sean Griffin 提交于
The original patch that added this concept can be found [here](https://web.archive.org/web/20090601022739/http://dev.rubyonrails.org/ticket/9767). The current default behavior is to cache everything except serialized columns, unless the user specified otherwise. If anyone were to specify otherwise, many types would actually be completely broken. Still, the method is left in place with a deprecation warning in case anyone is actually still calling this method.
-
由 Sean Griffin 提交于
We are no longer including column objects in YAML serialization, thanks to https://github.com/rails/rails/pull/15621
-
由 Sean Griffin 提交于
-
由 Akshay Vishnoi 提交于
-
由 eileencodes 提交于
add_constraints is complicated and difficult to read. This is the beginning of a long process of refactoring this code. First step: moved the join keys out of AssociationScope and into reflection. We then don't need to call `reflection` because now reflection is `self`. `foreign_key` must be named something else because reflection already has a `foreign_key` method and when passed into `JoinKeys` it was getting the wrong assignment. `reflection_foreign_key` seemed to be an appropriate name. I also named `key` `reflection_key` to match `reflection_foreign_key`.
-
由 Sean Griffin 提交于
We never want result types to override column types, and `decorate_columns` can only affect column types. No need to go through the decoration multiple times, we can just exclude the column types from the result types instead.
-
由 Kuldeep Aggarwal 提交于
-
由 Akshay Vishnoi 提交于
-
- 10 6月, 2014 14 次提交
-
-
由 Sean Griffin 提交于
``` activerecord/test/cases/adapters/postgresql/range_test.rb:159: warning: (...) interpreted as grouped expression activerecord/test/cases/finder_test.rb:38: warning: shadowing outer local variable - e activerecord/test/cases/finder_test.rb:43: warning: shadowing outer local variable - e ```
-
由 Sean Griffin 提交于
On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
-
由 Sean Griffin 提交于
-
由 Yves Senn 提交于
-
由 James Yang 提交于
-
由 Arthur Neves 提交于
-
由 eileencodes 提交于
Reflection has an available method that is used to check if the reflection is a collection. Any :has_many macro is considered a collection and `collection?` should be used instead of `macro == :has_many`.
-
由 eileencodes 提交于
By having the `:has_and_belongs_to_many` macro in the `@collection` we are punishing `:has_many` associations because it has to allocate the array and check the macro. @collection is returned to `macro == :has_many` and a new reflection class `HABTMReflection` is created to handle this case instead.
-
由 eileencodes 提交于
Instead of checking for `macro == :has_one` throughout the codebase we can create a `has_one?` method to match the `belongs_to?`, `polymorphic?` and other methods.
-
由 Rafael Mendonça França 提交于
This reverts commit dd3ea171 and add a regression test. Fixes #15418
-
由 Sean Griffin 提交于
In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
-
由 Sean Griffin 提交于
We should be able to rely on this object implenting the full type interface.
-
由 Rafael Mendonça França 提交于
Integration tests are inside protected_attributes test suite. Fixes #15496 Fixes rails/protected_attributes#35
-
由 Sean Griffin 提交于
- The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
-