| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
[ci skip] Remove useless "@api public/private"
|
| |
| |
| |
| | |
Other public APIs do not have these annotations.
|
|\ \
| |/
|/|
| | |
`restrict_with_error` message will now respect owner’s human name
|
| |
| |
| |
| | |
locale [kuboon & Ronak Jangir]
|
|\ \
| | |
| | | |
Improved ActiveRecord Connection Pool docs [ci skip]
|
| | | |
|
| | |
| | |
| | |
| | | |
[ci skip]
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
schneems/schneems/no-hardcoded-ignored-lines-in-schema-dumper
Don't hardcode table name
|
| | |
| | |
| | |
| | |
| | | |
The schema_migrations table name is configurable. We should use this value when checking for ignored table names when dumping schema instead of a hardcoded value.
|
| | | |
|
|\ \ \
| | | |
| | | | |
Doc SchemaMigration class.
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | |
| | | |
| | | | |
deivid-rodriguez/fix_undefined_method_error_on_exception
Fix undefined method error on exception
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The `error` method is not defined, in general, for exceptions. Instead,
print the exception message. This error was hiding actual meaningful DB
configuration errors. See http://stackoverflow.com/questions/18774463.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Follow up #21591.
The document of limit option for a text column is incorrect.
MySQL: the limit is byte length, not character length
Pg, Sqlite3: variable unlimited length
|
|\ \ \ \
| | | | |
| | | | | |
TEXT and BLOB limit is byte length, not character length.
|
| | | | | |
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Updated MySQL documentation link to MySQL latest version 5.7 everywhe…
|
| | |_|/
| |/| |
| | | |
| | | |
| | | | |
skip]
Bumps from `5.6` to `5.7`
|
|/ / /
| | |
| | |
| | |
| | | |
autoloading this could possibly cause some weird race condition
when calling an AR::Attribute's singleton method on a threaded server.
|
| | |
| | |
| | |
| | |
| | |
| | | |
The last call site of `last_version` was removed with:
838e18321118ee3ec6669217e5ea0216f79c969a
|
|\ \ \
| | | |
| | | | |
HasManyAssociation: moved half of counter cache code to reflection
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Current implementation has a lot of utility methods that accept
reflection call a lot of methods on it and exit.
E.g. has_counter_cache?(reflection)
It causes confusion and inability to cache result of the method even
through it always returns the same result for the same reflection
object.
It can be done easier without access to the association context
by moving code into reflection itself.
e.g. reflection.has_counter_cache?
Reflection is less complex object than association so moving code there
automatically makes it simplier to understand.
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Use `ActiveRecord::Tasks::DatabaseTasks.migrations_paths` explicit for db tasks
|
| | | | |
| | | | |
| | | | |
| | | | | |
`Migrator.migrations_paths`
|
| | | | |
| | | | |
| | | | |
| | | | | |
This method is private API and never used. Let's remove it.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`Schema#migrations_paths` is not supposed to be public API. In fact
it's only used inside `Schema` itself, so let's make it private.
|
| | | | |
| | | | |
| | | | |
| | | | | |
It is always passed in
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | | |
Usage was removed in 5c4495538b
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
robertjlooby/fix_overwriting_by_dynamic_finders"
This reverts commit d5ba9a42a6e93b163a49f99d739aa56820e044d0, reversing
changes made to 30c503395bf6bf7db1ec0295bd661ce644628db5.
Reason: This generate the dynalic finders more than one time
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | | |
put dynamic matchers on GeneratedAssociationMethods instead of model
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Added nodoc tag for the methods which returns object of private apis
|
| | | | | | | |
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Fix and Improve sql logging coloration in `ActiveRecord::LogSubscriber`.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
- CR feedback from @egilburg
Additionally
- Move logic for colorizing the payload name into a separate method
- Make some `ActiveRecord::LogSubscriber` instance methods private for clarity:
- `colorize_payload_name`
- `sql_color`
- `logger`
- Improve Changelog Documentation
GH #20885
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
- Improves coloring for statements like:
# Become WHITE
SELECT * FROM (
SELECT * FROM mytable FOR UPDATE
) ss WHERE col1 = 5;
LOCK TABLE table_name IN ACCESS EXCLUSIVE MODE;
# Becomes RED
ROLLBACK
- Reinstates the coloration of the `payload[:name]`.
Instead of simple alternating colors, adds meaning:
- `MAGENTA` for `"SQL"` or `blank?` payload names
- `CYAN` for Model Load/Exists
- Introduces specs for sql coloration.
- Introduces specs for payload name coloration.
GH#20885
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
[ci skip]
@sgrif can you review when you have time? Thanks!
|
|\ \ \ \ \ \ \ \
| |_|/ / / / / /
|/| | | | | | | |
Validate multiple contexts on `valid?` and `invalid?` at once
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Example:
```ruby
class Person
include ActiveModel::Validations
attr_reader :name, :title
validates_presence_of :name, on: :create
validates_presence_of :title, on: :update
end
person = Person.new
person.valid?([:create, :update]) # => true
person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]}
```
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Removes mandatory arguments from AR exceptions
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
This change allows to instantiate all ActiveRecordError descendant
execption classes without arguments, which might be useful in testing
and is far less surprising than mandatory arguments.
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Define `SchemaStatements#tables` as interface
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
These 3 methods expect `ConnectionAdapters` to have `tables` method,
so make it clear that `tables` method is interface.
* `ConnectionAdapters::SchemaCache#prepare_tables`
* `db:schema:cache:dump` task
* `SchemaDumper#tables`
|
|/ / / / / / / / / |
|
| | | | | | | | | |
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Its value never change since associations are defined at class load time
so there is no need to build the hash everytime the method is called.
Before this change:
Calculating -------------------------------------
reflections 804.000 i/100ms
-------------------------------------------------
reflections 8.213k (±26.2%) i/s - 36.180k
After this change:
Calculating -------------------------------------
reflections 24.548k i/100ms
-------------------------------------------------
reflections 1.591M (±25.7%) i/s - 7.364M
Benchmark script:
require 'bundler/setup'
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
100.times do |i|
create_table "users#{i}", force: true
end
create_table :cars, force: true do |t|
100.times do |i|
t.references "users#{i}"
end
end
end
class Car < ActiveRecord::Base
100.times do |i|
belongs_to "users#{i}".to_sym
end
end
Benchmark.ips do |x|
x.report('reflections') { Car.reflections }
end
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
PERF: Reduce allocation in `resolve_column_aliases`.
|
| | |/ / / / / / /
| |/| | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
Benchmark Script Used:
```
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', path: '~/rails' # master against ref "f1f0a3f8d99aef8aacfa81ceac3880dcac03ca06"
gem 'arel', github: 'rails/arel', branch: 'master'
gem 'rack', github: 'rack/rack', branch: 'master'
gem 'sass'
gem 'sprockets-rails', github: 'rails/sprockets-rails', branch: 'master'
gem 'sprockets', github: 'rails/sprockets', branch: 'master'
gem 'pg'
gem 'benchmark-ips'
end
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection('postgres://postgres@localhost:5432/rubybench')
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :name, :email
t.timestamps null: false
end
end
class User < ActiveRecord::Base; end
attributes = {
name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
email: "foobar@email.com",
}
1000.times { User.create!(attributes) }
Benchmark.ips(5, 3) do |x|
x.report('where with hash single') { User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
x.report('where with string single') { User.where("users.name = ?", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") }
x.report('where with hash double') { User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", email: "foobar@email.com") }
x.report('where with string double') { User.where("users.name = ? AND users.email = ?", "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "foobar@email.com") }
x.compare!
end
```
Before:
```
Calculating -------------------------------------
where with hash single
3.300k i/100ms
where with string single
4.965k i/100ms
where with hash double
2.594k i/100ms
where with string double
4.400k i/100ms
-------------------------------------------------
where with hash single
35.161k (± 1.2%) i/s - 178.200k
where with string single
53.368k (± 2.9%) i/s - 268.110k
where with hash double
27.364k (± 1.1%) i/s - 137.482k
where with string double
46.876k (± 2.1%) i/s - 237.600k
Comparison:
where with string single: 53368.1 i/s
where with string double: 46875.5 i/s - 1.14x slower
where with hash single: 35160.8 i/s - 1.52x slower
where with hash double: 27364.0 i/s - 1.95x slower
```
After:
```
Calculating -------------------------------------
where with hash single
3.403k i/100ms
where with string single
5.167k i/100ms
where with hash double
2.659k i/100ms
where with string double
4.597k i/100ms
-------------------------------------------------
where with hash single
36.410k (± 1.3%) i/s - 183.762k
where with string single
55.009k (± 2.6%) i/s - 279.018k
where with hash double
27.951k (± 1.4%) i/s - 140.927k
where with string double
48.362k (± 2.6%) i/s - 243.641k
Comparison:
where with string single: 55008.6 i/s
where with string double: 48361.5 i/s - 1.14x slower
where with hash single: 36410.1 i/s - 1.51x slower
where with hash double: 27950.9 i/s - 1.97x slower
```
|