| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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('all') { User.all }
end
key =
if RUBY_VERSION < '2.2'
:total_allocated_object
else
:total_allocated_objects
end
before = GC.stat[key]
User.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
after = GC.stat[key]
puts "Total Allocated Object: #{after - before}"
```
Before:
```
Calculating -------------------------------------
all 17.569k i/100ms
-------------------------------------------------
all 190.854k (± 3.3%) i/s - 966.295k
Total Allocated Object: 85
```
After:
```
Calculating -------------------------------------
all 22.237k i/100ms
-------------------------------------------------
all 262.715k (± 5.5%) i/s - 1.312M
Total Allocated Object: 80
```
|
|
|
|
|
|
|
|
| |
Apparently I managed to forget how similar the "tests passing" and
"no status reported" merge indicators look.
Note that the previous `stubs` in test_add_index wasn't working:
the method was still called, and just happened to return false.
|
|\
| |
| |
| |
| |
| | |
greysteil/support-postgres-drop-index-concurrently
Support dropping indexes concurrently in Postgres
|
| |
| |
| |
| |
| | |
See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html
for more details.
|
|/ |
|
|
|
| |
Sometimes opts passed in might respond to ==, e.g. `Arel::Nodes::Grouping`. In this case, `opts == :chain` returns `Arel::Nodes::Equality` which causes odd behaviour. Prefer `if :chain == opts` which guarantees that `Symbol#==` would be invoked. Alternatively consider `eql?`.
|
|\
| |
| |
| | |
Add detailed error message to `IrreversibleMigration`
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
Since the strings are dynamically computed from a constant, the actual
strings we're creating are a known set. We can compute them ahead of
time, and reduce the number of allocations in that method.
|
| |
| |
| |
| | |
[Rafael Mendonça França + Jean Boussier]
|
| | |
|
|\ \
| | |
| | | |
Support MySQL 5.7.8 which enables show_compatibility_56=off
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We are only supporting Ruby 2.2 and later in Rails 5, so we do not need
an actual constant here. Additionally, referencing a constant actually
does a hash lookup (because constants are not constant in Ruby >_>).
This will be marginally (likely immeasurable) faster. It is less ugly.
|
|\ \ \
| | | |
| | | | |
[ci skip] Update what methods `Migration#change` can reverse
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
* Documentations and comments about what methods
`Migration#change` can reverse is out of date.
For example `change_column_default` is now reversible
by this [commit](https://github.com/rails/rails/pull/20018).
* Comments about `CommandRecorder` dose not match with Rails Guide.
For example `add_foreign_key` is listed only on Rails Guide.
|
|\ \ \ \
| |/ / /
|/| | | |
Make revert of `disable_extension` to work
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is fix of #11826 which miss to add `disable_extension` to
`ReversibleAndIrreversibleMethods`. So `CommandRecorder#method_missing`
catches `change_column_default` and @delegate's method is called.
|
|\ \ \ \
| |/ / /
|/| | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Closes #21418.
Previously schema names were not quoted. This leads to issues when a
schema names contains a ".". Methods in `schema_statements.rb` should
quote user input.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
[ci skip]
Currently the `#tables` method does not make use of the `name`
argument and always returns all the tables in the schema search
path. However the docs suggest different behavior.
While we should porbably adjust the implementation to provide this
behavior, let's make the docs right for now (also for `4-2-stable`) and
then implement the behavior on `master`.
|
| |_|/
|/| | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Removed duplicate requires
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Use `ActiveRecord::Migration#connection` instead of `@connection`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`ActiveRecord::Migration` has `connetion` method so replace to use
`connection` method to get `@connection` as much as possible
|
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This fixes the following warning.
```ruby
warning: assigned but unused variable - index_definition
```
|
|\ \ \ \
| | | | |
| | | | | |
Removed mocha from Active Record Part 1
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Make `change_column_default` to work
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This is fix of #20018 which removes `change_column_default` from
array, so `CommandRecorder#method_missing` catches
`change_column_default` and @delegate's method is called.
This PR
* fix this bug
* define `ReversibleAndIrreversibleMethods` const making clear
which this array means to prevent these miss
|
| | | | | | |
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | |
| | | | | |
| | | | | | |
vrybas/rdoc-fix-typo-belongs-to-inverse-of-class-name
RDoc: fix wrong model name `:inverse_of` with `:belongs_to` [ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
There's a typo in ActiveRecord associations RDocs.
Wrong `Taggable` model name, instead of `Tagging` in example of using
option `:inverse_of` with `:belongs_to` association.
Commit where typo was introduced:
https://github.com/rails/rails/commit/91fd6510563f84ee473bb217bc63ed598abe3f24#diff-39001423802a8470dba9c931e66e101eR11
First it appears in `activerecord/CHANGELOG` in example of `:inverse_of`
usage:
```ruby
class Post < ActiveRecord::Base
has_many :taggings
has_many :tags, :through => :taggings
end
class Tagging < ActiveRecord::Base
belongs_to :post
belongs_to :tag, :inverse_of => :tagging # :inverse_of must be set!
end
class Tag < ActiveRecord::Base
has_many :taggings
has_many :posts, :through => :taggings
end
post = Post.first
tag = post.tags.build :name => "ruby"
!> tag.save # will save a Taggable linking to the post
```
The last line should be
```ruby
tag.save # will save a Tagging linking to the post
```
The same typo appears in
`activerecord/lib/active_record/associations.rb`.
The association name is given as `:inverse_of => :taggings`, but class
name is `Taggable`.
```ruby
# @post = Post.first
# @tag = @post.tags.build :name => "ruby"
# @tag.save
#
!> # The last line ought to save the through record (a <tt>Taggable</tt>). This will only work if the
# <tt>:inverse_of</tt> is set:
#
!> # class Taggable < ActiveRecord::Base
# belongs_to :post
!> # belongs_to :tag, :inverse_of => :taggings
# end
```
This PR fixes model name.
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
[ci skip] Fix migration file's timestamp
|
| | |_|_|/ /
| |/| | | |
| | | | | |
| | | | | | |
In rails generally migration file's timestamp is "YYYYMMDDHHMMSS".
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add `assert_nothing_raised` to make clear test case perpose
|
| | | | | | | |
|
| | | | | | | |
|
| |_|_|/ / /
|/| | | | | |
|
| |/ / / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Since after 87d1aba3c `dependent: :destroy` callbacks on has_one
assocations run *after* destroy, it is possible that a nullification is
attempted on an already destroyed target:
class Car < ActiveRecord::Base
has_one :engine, dependent: :nullify
end
class Engine < ActiveRecord::Base
belongs_to :car, dependent: :destroy
end
> car = Car.create!
> engine = Engine.create!(car: car)
> engine.destroy! # => ActiveRecord::ActiveRecordError: cannot update a
> destroyed record
In the above case, `engine.destroy!` deletes `engine` and *then* triggers the
deletion of `car`, which in turn triggers a nullification of `engine.car_id`.
However, `engine` is already destroyed at that point.
Fixes #21223.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Remove test helper method to inside test method
|