Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
edipofederle committed Jul 9, 2021
1 parent 64a5a65 commit b792f08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Expand Up @@ -105,9 +105,9 @@ def belongs_to_options(options)
rhs_options[:foreign_key] = options[:association_foreign_key]
end

if options.key? :autosave
rhs_options[:autosave] = options[:autosave]
end
if options.key? :autosave
rhs_options[:autosave] = options[:autosave]
end

rhs_options
end
Expand Down
12 changes: 6 additions & 6 deletions activerecord/test/cases/autosave_association_test.rb
Expand Up @@ -155,21 +155,21 @@ def test_should_not_add_the_same_callbacks_multiple_times_for_has_and_belongs_to
end

def test_should_save_associated_records_when_has_and_belongs_to_many_with_autosave
book = PublishedBook.new(name: 'Good title', isbn: "010101101")
author = Author.create!(name: 'Jhon')
book.authors_autosave << author
book = PublishedBook.new(name: "Good title", isbn: "010101101")
author = Author.create!(name: "Jhon")
book.authors_autosave << author
book.save!

like = Like.new(reason: 'Good content.')
like = Like.new(reason: "Good content.")
book = PublishedBook.find(book.id)
like.published_books << book
author = book.authors_autosave[0]
author.name = 'Paul'
author.name = "Paul"
assert_equal true, author.changed?
assert_equal false, book.changed?
like.save!

assert_equal author.reload.name, 'Paul'
assert_equal author.reload.name, "Paul"
end

def test_cyclic_autosaves_do_not_add_multiple_validations
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/models/like.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Like < ActiveRecord::Base
has_and_belongs_to_many :published_books, :autosave => true
has_and_belongs_to_many :published_books, autosave: true
end
2 changes: 1 addition & 1 deletion activerecord/test/schema/schema.rb
Expand Up @@ -560,7 +560,7 @@
add_foreign_key :lessons_students, :students, on_delete: :cascade

create_table :likes, force: true do |t|
t.string :reason, :length => 250
t.string :reason, length: 250
end

create_table :books_likes, force: true do |t|
Expand Down

0 comments on commit b792f08

Please sign in to comment.