Skip to content

Use assign_attributes to change attributes #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/strip_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def self.strip_record(record, options = {})
attributes.each do |attr, value|
original_value = value
value = strip_string(value, options)
record[attr] = value if original_value != value
record.assign_attributes(attr => value) if original_value != value
end

record
Expand Down
1 change: 0 additions & 1 deletion strip_attributes.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
}

spec.add_runtime_dependency "activemodel", ">= 3.0", "< 8.0"
spec.add_development_dependency "active_attr", "~> 0.15"
spec.add_development_dependency "minitest", ">= 5.0", "< 6.0"
spec.add_development_dependency "minitest-matchers_vaccine", "~> 1.0" unless ENV["SKIP_VACCINE"]
spec.add_development_dependency "minitest-reporters", ">= 0.14.24"
Expand Down
8 changes: 3 additions & 5 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new
end

require "active_attr"
require "strip_attributes"

class Tableless
include ActiveAttr::BasicModel
include ActiveAttr::TypecastedAttributes
include ActiveAttr::Serialization

include ActiveModel::Model
include ActiveModel::Attributes
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
end

Expand Down