| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure it works with mix of symbols and strings, and with a select
clause possibly containing more than one column.
Also remove support for pluck with an array of columns, in favor of
passing the list of attributes:
Model.pluck(:a, :b)
See comments: https://github.com/rails/rails/pull/6500#issuecomment-6030292
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When generating xml with a custom implementation of serializable_hash,
if using the :except option, it was being overriden by the default AR
implementation that attempts to ignore the inheritance column from STI
automatically. So, if you have an implementation like this:
def serializable_hash(options={})
super({ except: %w(some_attr) }.merge!(options))
end
The :except option was correctly being used for :json generation, but
not for :xml, because the options hash already contained the :except
key with the inheritance column, thus overriding the customization.
This commit fixes this problem by removing the :except logic from the
xml serializer, that happened before calling serializable_hash. Since
serializable_hash also does the same check for inheritance column, this
logic was duplicated in both places, thus it's safe to remove it from
xml serializer (see ActiveRecord::Serialization#serializable_hash).
This is an attempt to solve issue #2498, that claims for a
"Single transformation API for both xml and json representations".
|
|
|
|
|
|
| |
ActiveRecord json/xml serialization should use as base
serializable_hash, provided by ActiveModel. Add some more coverage
around options :only and :except for both json and xml serialization.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve the derivation of HABTM join table name to take account of nesting.
It now takes the table names of the two models, sorts them lexically and
then joins them, stripping any common prefix from the second table name.
Some examples:
Top level models
(Category <=> Product)
Old: categories_products
New: categories_products
Top level models with a global table_name_prefix
(Category <=> Product)
Old: site_categories_products
New: site_categories_products
Nested models in a module without a table_name_prefix method
(Admin::Category <=> Admin::Product)
Old: categories_products
New: categories_products
Nested models in a module with a table_name_prefix method
(Admin::Category <=> Admin::Product)
Old: categories_products
New: admin_categories_products
Nested models in a parent model
(Catalog::Category <=> Catalog::Product)
Old: categories_products
New: catalog_categories_products
Nested models in different parent models
(Catalog::Category <=> Content::Page)
Old: categories_pages
New: catalog_categories_content_pages
Also as part of this commit the validity checks for HABTM assocations have
been moved to ActiveRecord::Reflection One side effect of this is to move when
the exceptions are raised from the point of declaration to when the association
is built. This is consistant with other association validity checks.
|
| |
|
|\
| |
| | |
add :nodoc: to AM::AttributeMethods#instance_method_already_implemented?...
|
|/
|
|
| |
skip]
|
| |
|
|\
| |
| | |
Make the Resolver template cache threadsafe
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
In order to avoid holding a global lock when doing template
resolution, instead add individual locks on a per cache entry
basis. The global lock is now only used for manipulation of the main
cache data structure.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).
This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
|
|\ \
| | |
| | | |
add :nodoc: to AM::AttributeMethods::AttributeMethodMatcher
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
changed the firm of changes_from_zero_to_string?
|
| | |
| | |
| | |
| | | |
delete *column* because is unused by the method.
|
|\ \ \
| | | |
| | | | |
Inflector: Added missing tests cases to ensure idempotency of singularize and pluralize
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a follow up to #4719. It appears that singularize and pluralize
are supposed to be idempotent - i.e. when you call singularize or
pluralize multiple times on the same string, you should get the same
result. (At least for the "officially supported" cases that the stock
inflector is designed to handle.) #4719 added the missing tests for
regular cases, and this commit added the missing tests for the
irregularities.
While I'm at that, I also synced up the irregularity test cases with
the current set of irregularity cases that we ship out-of-the-box.
|
|\ \ \
| |/ /
|/| | |
Removed warnings.
|
|/ /
| |
| |
| |
| | |
1. Change in test name as already defined.
2. ambiguous first argument; put parentheses or
even spaces
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Log listener is a singleton shared across threads, so make sure the
event queues are local to each thread.
|
|\ \
| | |
| | | |
Mailer with no implicit template
|
|/ / |
|
|\ \
| | |
| | | |
Refactor testcase codes. It's repeated.
|
|/ / |
|
|\ \
| | |
| | | |
Refactor db:structure:load task.
|
| | | |
|
| | | |
|
|\ \ \
| |/ /
|/| |
| | | |
Fix GH #4259. When we execute schema dumper, we must remove table_name_prefix and table_name_suffix.
|
| | |
| | |
| | |
| | | |
we execute schema dumper.
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Add prev_quarter and next_quarter methods in Time/Date/DateTime calculations.
Similar to prev_month and next_month, it returns the date with the same day
in the previous or next quarter:
t = Time.local(2010, 5, 8) # => Sat, 08 May 2010
t.prev_quarter # => Mon, 08 Feb 2010
t.next_quarter # => Sun, 08 Aug 2010
Closes #6402
|
| | | | |
|
| |\ \ \
| | | | |
| | | | | |
Prevent concurrent compilation of templates - closes #6400
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This addresses an issue where in multi-threaded environments
multiple threads can attempt to compile a template at the same time,
which occasionally causes particular templates to end up in a bad
state.
So, add synchronization such that only a single thread can attempt to
compile a template at one time.
|
| | | | | |
|
| |\ \ \ \
| | | | | |
| | | | | | |
Correct the AP test。
|
| |/ / / / |
|
| | | | | |
|
| | | | | |
|
|/ / / / |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Closes #6007
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
Also use if/else block to not use short circuit return
|