Skip to content

Commit

Permalink
Updated instructions for removing a column to append to ignored_colum…
Browse files Browse the repository at this point in the history
…ns - closes #254
  • Loading branch information
ankane committed Feb 22, 2024
1 parent 9f4dbfb commit 2d9b2d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.7.1 (unreleased)

- Updated instructions for removing a column to append to `ignored_columns`

## 1.7.0 (2024-01-05)

- Added check for `add_unique_constraint`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Active Record caches attributes, which causes problems
when removing columns. Be sure to ignore the column:
class User < ApplicationRecord
self.ignored_columns = ["name"]
self.ignored_columns += ["name"]
end
Deploy the code, then wrap this step in a safety_assured { ... } block.
Expand Down Expand Up @@ -110,7 +110,7 @@ end

```ruby
class User < ApplicationRecord
self.ignored_columns = ["some_column"]
self.ignored_columns += ["some_column"]
end
```

Expand Down
2 changes: 1 addition & 1 deletion lib/strong_migrations/checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def check_remove_column(method, *args)
cols
end

code = "self.ignored_columns = #{columns.inspect}"
code = "self.ignored_columns += #{columns.inspect}"

raise_error :remove_column,
model: args[0].to_s.classify,
Expand Down
2 changes: 1 addition & 1 deletion test/remove_column_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_remove_columns
end

def test_remove_columns_type
assert_unsafe RemoveColumnsType, 'self.ignored_columns = ["name", "other"]'
assert_unsafe RemoveColumnsType, 'self.ignored_columns += ["name", "other"]'
end

def test_remove_timestamps
Expand Down

0 comments on commit 2d9b2d7

Please sign in to comment.