Skip to content

Commit

Permalink
Remove _previously_was dirty methods
Browse files Browse the repository at this point in the history
These haven't been released yet...
  • Loading branch information
shioyama committed Oct 21, 2019
1 parent a664641 commit 39ea371
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
14 changes: 0 additions & 14 deletions lib/mobility/plugins/active_model/dirty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module ActiveModel
- +title_will_change!+
- +title_previously_changed?+
- +title_previous_change+
- +title_previous_was+
- +restore_title!+
The following methods are also patched to work with translated attributes:
Expand All @@ -39,9 +38,6 @@ def initialize(*attribute_names)

if ::ActiveModel::VERSION::STRING >= '5.0' # methods added in Rails 5.0
define_ar_5_0_dirty_methods(attribute_names)
if ::ActiveModel::VERSION::STRING >= '5.1' # methods added in Rails 5.1
define_ar_6_0_dirty_methods(attribute_names)
end
end
end

Expand Down Expand Up @@ -107,16 +103,6 @@ def define_ar_5_0_dirty_methods(attribute_names)
end
end

def define_ar_6_0_dirty_methods(attribute_names)
m = self

attribute_names.each do |name|
define_method "#{name}_previously_was" do
mutations_before_last_save_from_mobility.original_value(m.append_locale(name))
end
end
end

module InstanceMethods
def changed_attributes
super.merge(mutations_from_mobility.changed_values)
Expand Down
4 changes: 0 additions & 4 deletions spec/mobility/plugins/active_model/dirty_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ def save
expect(article.title_previously_changed?).to eq(true)
expect(article.title_previous_change).to eq(["foo", "bar"])
expect(article.title_changed?).to eq(false)

if ENV['RAILS_VERSION'].present? && ENV['RAILS_VERSION'] >= '6.0'
expect(article.title_previously_was).to eq('foo')
end
end

article.title_will_change!
Expand Down

0 comments on commit 39ea371

Please sign in to comment.