- 30 1月, 2014 4 次提交
-
-
由 Marc-Andre Lafortune 提交于
-
由 Godfrey Chan 提交于
Dangerous name conflicts includes instance or class method conflicts with methods defined within `ActiveRecord::Base` but not its ancestors, as well as conflicts with methods generated by other enums on the same class. Fixes #13389.
-
由 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*
-
由 Godfrey Chan 提交于
Before: >> ActiveRecord::Base.respond_to?(:find_by_something) NoMethodError: undefined method `abstract_class?' for Object:Class After: >> ActiveRecord::Base.respond_to?(:find_by_something) => false
-
- 29 1月, 2014 2 次提交
-
-
由 Mauricio Linhares 提交于
As per the documentation at lock!, if the :lock option is a string it should use the given SQL to generate the lock statement.
-
由 Tsutomu Kuroda 提交于
With this we can write `Model#select(:aliased)`, `Model#order(:aliased)`, `Model#reoder(aliased: :desc)`, etc. Supplementary work to 54122067.
-
- 28 1月, 2014 1 次提交
-
-
由 Vipul A M 提交于
Add docs about behaviour of replacing a has_one associate object, that the previous one is deleted even if the new one doesn't get persisted to database. Fixes #13197 . [ci skip]
-
- 27 1月, 2014 1 次提交
-
-
由 Washington Luiz 提交于
Hopefully make it easier to debug errors. e.g Before: RuntimeError: unscope(where: "deleted_at") failed: unscoping String is unimplemented. After: RuntimeError: unscope(where: "deleted_at") failed: unscoping String "'t'='t'" is unimplemented.
-
- 25 1月, 2014 1 次提交
-
-
由 Kuldeep Aggarwal 提交于
-
- 23 1月, 2014 1 次提交
-
-
由 Keenan Brock 提交于
Move serialization dirty into serialization.rb
-
- 22 1月, 2014 10 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Keenan Brock 提交于
-
由 kei 提交于
-
由 Kelsey Schlarman 提交于
Need to define #reset on CollectionProxy.
-
由 Jason Meller 提交于
This commit fixes two regressions introduced in cafe31a0 where newly created finder methods #second, #third, #forth, and #fifth caused a NoMethodError error on reload associations and where we were pulling the wrong element out of cached associations. Examples: some_book.authors.reload.second # Before # => NoMethodError: undefined method 'first' for nil:NilClass # After # => #<Author id: 2, name: "Sally Second", ...> some_book.first.authors.first some_book.first.authors.second # Before # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 1, name: "Freddy First", ...> # After # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 2, name: "Sally Second", ...> Fixes #13783.
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
This will make simpler to compare if the values changed in the save_changed_attribute method.
-
由 Kuldeep Aggarwal 提交于
-
由 Rafael Mendonça França 提交于
Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent results among different database engines. But for singular associations this behavior is not needed since we will have one record to return. As this ORDER BY option can lead some performance issues we are removing it for singular associations accessors. Fixes #12623.
-
由 Yves Senn 提交于
This fixes a bug where `select(:id)` combined with `joins()` raised: ``` ActiveRecord::StatementInvalid: SQLite3::SQLException: ambiguous column name: id: SELECT id, authors.author_address_id FROM "posts" INNER JOIN "authors" ON "authors"."id" = "posts"."author_id" ORDER BY posts.id LIMIT 3 ``` The `select_values` are still String and Symbols because other parts (mainly calculations.rb) rely on that fact. /cc @tenderlove
-
- 21 1月, 2014 7 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
To make this possible we have to override the save_changed_attribute hook.
-
由 Rafael Mendonça França 提交于
This will make easier to hook on this feature to customize the behavior
-
由 Alexander Balashov 提交于
Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
-
由 Carlos Antonio da Silva 提交于
With the introduction of `#second` method and friends, we added an offsets hash which replaced the @first variable, so removing it from the reset method to avoid creating an unused variable now. Introduced in bc625080.
-
由 Rafael Mendonça França 提交于
This variable is internal and should not be exposed to end users
-
由 Jason Meller 提交于
This commit bring the famous ordinal Array instance methods defined in ActiveSupport into ActiveRecord as fully-fledged finders. These finders ensure a default ascending order of the table's primary key, and utilize the OFFSET SQL verb to locate the user's desired record. If an offset is defined in the query, calling #second adds to the offset to get the actual desired record. Fixes #13743.
-
- 19 1月, 2014 1 次提交
-
-
由 Godfrey Chan 提交于
This fixes a regression (#13744) that was caused by 67d8bb96. In 67d8bb96, we introduced lazy rollback for records, such that the record's internal states and attributes are not restored immediately after a transaction rollback, but deferred until they are first accessed. This optimization is only performed when the model does not have any transactional callbacks (e.g. `after_commit` and `after_create`). Unfortunately, the models used to test the affected codepaths all comes with some sort of transactional callbacks. Therefore this codepath remains largely untested until now and as a result there are a few issues in the implementation that remains hidden until now. First, the `sync_with_transaction_state` (or more accurately, `update_attributes_from_transaction_state`) would perform the synchronization prematurely before a transaction is finalized (i.e. comitted or rolled back). As a result, when the actuall rollback happens, the record will incorrectly assumes that its internal states match the transaction state, and neglect to perform the restore. Second, `update_attributes_from_transaction_state` calls `committed!` in some cases. This in turns checks for the `destroyed?` state which also requires synchronization with the transaction stae, which causes an infnite recurrsion. This fix works by deferring the synchronization until the transaction has been finalized (addressing the first point), and also unrolled the `committed!` and `rolledback!` logic in-place (addressing the second point). It should be noted that the primary purpose of the `committed!` and `rolledback!` methods are to trigger the relevant transactional callbacks. Since this code path is only entered when there are no transactional callbacks on the model, this shouldn't be necessary. By unrolling the method calls, the intention here (to restore the states when necessary) becomes more clear.
-
- 18 1月, 2014 2 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
- 17 1月, 2014 1 次提交
-
-
由 T.J. Schuck 提交于
-
- 16 1月, 2014 3 次提交
-
-
由 Harry Brundage 提交于
-
由 Carlos Antonio da Silva 提交于
This has been added 9 years ago in a677da20, and removed 6 years ago in 38f8252e.
-
由 Carlos Antonio da Silva 提交于
-
- 15 1月, 2014 2 次提交
-
-
由 Aaron Patterson 提交于
rather than allocating a new Relation, just make the AST directly
-
由 Godfrey Chan 提交于
-
- 14 1月, 2014 4 次提交
-
-
由 Cody Cutrer 提交于
-
由 Ujjwal Thaakar 提交于
The `subclass_from_attrs` method is called even if the column specified by the `inheritance_column` setting doesn't exist. This prevents setting associations via the attributes hash if the association name clashes with the value of the setting, typically `:type`. This worked previously in Rails 3.2.
-
由 Godfrey Chan 提交于
Example: class Conversation < ActiveRecord::Base enum status: [ :active, :archived ] end Before: Conversation::STATUS # => { "active" => 0, "archived" => 1 } After: Conversation.statuses # => { "active" => 0, "archived" => 1 }
-
由 Aaron Patterson 提交于
-