- 12 7月, 2014 1 次提交
-
-
由 Gregory Igelmund 提交于
-
- 11 7月, 2014 1 次提交
-
- 01 7月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
We already had one in the public API that people can use more easily for the transition
-
- 30 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
As discussed in https://github.com/plataformatec/simple_form/pull/1094, we should not encourage usage of `columns_hash`, and instead provide an alternate method to determine whether or not an attribute exists. The language `attribute` was chosen over `column` since these are in the `AttributeMethods` module.
-
- 23 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
This is public API, and `simple_form` depends on the `nil` return value. We need to go through a deprecation cycle to return a null object. If people want hash access, they can access the hash.
-
- 22 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
-
- 20 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
Mostly delegation to start, but we can start moving a lot of behavior in bulk to this object.
-
- 14 6月, 2014 2 次提交
-
-
由 Sean Griffin 提交于
We always define attribute methods in the constructor or in `init_with`.
-
由 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
-
- 05 6月, 2014 1 次提交
-
-
由 Yves Senn 提交于
Follow up to #15438 and #15502. /cc @sgrif
-
- 04 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
-
- 03 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
-
- 02 6月, 2014 2 次提交
-
-
由 Sean Griffin 提交于
Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing
-
由 Sean Griffin 提交于
During `init_with`, the attributes given to the coder will be placed into `@raw_attributes`. As such, we should read from `@raw_attributes` when encoding, rather than `@attributes`, which has been type cast.
-
- 31 5月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
`@attributes` was actually used for `_before_type_cast` and friends, while `@attributes_cache` is the type cast version (and caching is the wrong word there, but I'm working on removing the conditionals around that). I opted for `@raw_attributes`, because `_before_type_cast` is also semantically misleading. The values in said hash are in the state given by the form builder or database, so raw seemed to be a good word.
-
- 24 5月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
It appears to have been used at some point in the past, but is no longer used in any meaningful way. Whether a column is considered primary is a property of the model, not the schema/column. This also removes the need for yet another layer of caching of the model's schema, and we can leave that to the schema cache.
-
- 23 5月, 2014 3 次提交
-
-
由 Bin Huang 提交于
-
由 Godfrey Chan 提交于
2d73f5ae forces AR to enter the `define_attribute_methods` method whenever it instantiate a record from the `init_with` entry point. This is a potential performance hotspot, because `init_with` is called from all `find*` family methods, and `define_attribute_methods` is slow because it tries to acquire a lock on the mutex everytime it is entered. By using [DCL](http://en.wikipedia.org/wiki/Double-checked_locking), we can avoid grabbing the lock most of the time when the attribute methods are already defined (the common case). This is made possible by the fact that reading an instance variable is an atomic operation in Ruby. Credit goes to Aaron Patterson for pointing me to DCL and filling me in on the atomicity guarantees in Ruby. [*Godfrey Chan*, *Aaron Patterson*]
-
由 Aaron Patterson 提交于
-
- 15 5月, 2014 1 次提交
-
-
由 Kuldeep Aggarwal 提交于
-
- 12 5月, 2014 2 次提交
-
-
由 Guillermo Iguaran 提交于
Improve documentation
-
由 Chris Beer 提交于
-
- 04 4月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
Add tests to make sure scopes cannot be create with names such as: private, protected, public. Make sure enum values don't collide with those methods too.
-
- 11 3月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
PR #14052 Added a regression where it was only looking for methods in one level up, So when the method was defined in a 2+ levels up the inheritance chain, the method was not found as defined.
-
- 24 2月, 2014 1 次提交
-
-
由 Godfrey Chan 提交于
conflicting private method defined on its ancestors. The problem is that `method_defined_within?(name, klass, superklass)` only works correclty when `klass` and `superklass` are both `Class`es. If both `klass` and `superklass` are both `Class`es, they share the same inheritance chain, so if a method is defined on `klass` but not `superklass`, this method must be introduced at some point between `klass` and `superklass`. This does not work when `superklass` is a `Module`. A `Module`'s inheritance chain contains just itself. So if a method is defined on `klass` but not on `superklass`, the method could still be defined somewhere upstream, e.g. in `Object`. This fix works by avoiding calling `method_defined_within?` with a module while still fufilling the requirement (checking that the method is defined withing `superclass` but not is not a generated attribute method). 4d8ee288 is likely an attempted partial fix for this problem. This unrolls that fix and properly check the `superclass` as intended. Fixes #11569.
-
- 30 1月, 2014 2 次提交
-
-
由 Mauricio Linhares 提交于
Fixing issue with activerecord serialization not being able to dump a record after loading it from YAML - fixes #13861
-
由 Godfrey Chan 提交于
Similar to dangerous attribute methods, a scope name conflict is dangerous if it conflicts with an existing class method defined within `ActiveRecord::Base` but not its ancestors. See also #13389. *Godfrey Chan*, *Philippe Creux*
-
- 19 12月, 2013 1 次提交
-
-
由 nishant-cyro 提交于
-
- 30 10月, 2013 1 次提交
-
-
由 Jan Bernacki 提交于
-
- 25 10月, 2013 1 次提交
-
-
由 Matt Jones 提交于
-
- 30 9月, 2013 1 次提交
-
-
由 thedarkone 提交于
This was happening when a `super` call in an overwritten attribute method was triggering a method_missing fallback, because attribute methods haven't been generated yet. class Topic < ActiveRecord::Base def title # `super` would re-invoke this method if define_attribute_methods # hasn't been called yet resulting in double '!' appending super + '!' end end
-
- 29 9月, 2013 1 次提交
-
-
由 thedarkone 提交于
TS::Cache#compute_if_absent guarantees that only a single thread will get to execute the provided block for a given key.
-
- 16 7月, 2013 1 次提交
-
-
由 Arun Agrawal 提交于
for attributes that are columns.
-
- 10 7月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 09 7月, 2013 1 次提交
-
-
由 namusyaka 提交于
-
- 04 7月, 2013 3 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 03 7月, 2013 2 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-