Default Gem | 3.0.6 | Default Gem | 3.1.6 | Major diff |
---|---|---|---|---|
abbrev | 0.1.0 | abbrev | 0.1.0 | No |
base64 | 0.1.0 | base64 | 0.1.1 | No |
benchmark | 0.1.1 | benchmark | 0.2.0 | No |
bigdecimal c | 3.0.0 | bigdecimal c | 3.1.1 | No |
bundler | 2.2.33 | bundler | 2.3.27 | No |
cgi c | 0.2.2 | cgi c | 0.3.6 | No |
db/model | string/no enum | integer/array enum | integer/hash enum | string/hash enum | pg enum/hash enum |
---|---|---|---|---|---|
migration(pg) | `add_column(:scraper_re |
- Assigning an object to a
belongs_to
association does not automatically save the object. It does not save the associated object either.
- When you assign an object to a
has_one
association, that object is automatically saved (in order to update its foreign key). - In addition, any object being replaced is also automatically saved, because its foreign key will change too
- If either of these saves fails due to validation errors, then the assignment statement returns false and the assignment itself is cancelled.
- If the parent object (the one declaring the
has_one
association) is unsaved (that is,new_record?
returns true) then the child objects are not saved. They will automatically when the parent object is saved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# This script illustrates caveats of ActiveRecord association autosave | |
# when using a combination of database constrains with a through association (join model) | |
# | |
# ## USAGE | |
# | |
# ruby through_association_autosave.rb | |
# | |
# ## EDGE CASE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "activerecord", "6.1" | |
gem "sqlite3" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "activerecord", "6.0.3.7" | |
gem "paper_trail", "~> 12", require: false | |
gem "sqlite3" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'rails', '~> 5.1.7' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'rails', '~> 5.2.3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
# Activate the gem you are reporting the issue against. |
NewerOlder