Skip to content

Commit

Permalink
fix bug in active record columns compiler where column type option ca…
Browse files Browse the repository at this point in the history
…n be nil
  • Loading branch information
stathis-alexander committed Oct 12, 2024
1 parent e9631b6 commit da6b0bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
boba (0.0.6)
boba (0.0.7)
sorbet-static-and-runtime (~> 0.5)
tapioca (~> 0.16.2)

Expand Down
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Boba History

## 0.0.7

- Fix bug in `ActiveRecordColumnsPersisted` where `@column_type_option` can be `nil`.

## 0.0.6

- Fix a bug inheriting from default Tapioca compilers if corresponding Tapioca default compilers don't exist because
Expand Down
2 changes: 1 addition & 1 deletion lib/boba/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# frozen_string_literal: true

module Boba
VERSION = "0.0.6"
VERSION = "0.0.7"
end
4 changes: 2 additions & 2 deletions lib/tapioca/dsl/compilers/active_record_columns_persisted.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def type_for(attribute_name, column_name = attribute_name)

sig { params(column_name: String).returns([String, String]) }
def column_type_for(column_name)
return ["T.untyped", "T.untyped"] if @column_type_option.untyped?
return ["T.untyped", "T.untyped"] if column_type_option.untyped?

nilable_column = !has_non_null_database_constraint?(column_name) &&
!has_unconditional_presence_validator?(column_name)
Expand All @@ -169,7 +169,7 @@ def column_type_for(column_name)
getter_type
end

if @column_type_option.persisted? && (virtual_attribute?(column_name) || !nilable_column)
if column_type_option.persisted? && (virtual_attribute?(column_name) || !nilable_column)
[getter_type, setter_type]
else
getter_type = as_nilable_type(getter_type) unless column_type_helper.send(
Expand Down

0 comments on commit da6b0bb

Please sign in to comment.