Skip to content

Commit 169d79f

Browse files
committed
Guard against empty view definitions when sb_helptext fails silently. Fixes #337.
1 parent dbb559f commit 169d79f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
## v4.2.1
3+
4+
#### Fixed
5+
6+
* Guard against empty view definitions when `sb_helptext` fails silently. Fixes #337.
7+
8+
29
## v4.2.0
310

411
#### Added

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ def table_name_or_views_table_name(table_name)
415415

416416
def views_real_column_name(table_name, column_name)
417417
view_definition = schema_cache.view_information(table_name)[:VIEW_DEFINITION]
418+
return column_name unless view_definition
418419
match_data = view_definition.match(/([\w-]*)\s+as\s+#{column_name}/im)
419420
match_data ? match_data[1] : column_name
420421
end

0 commit comments

Comments
 (0)