Skip to content

Commit 67ef51d

Browse files
committed
Memoize some values
1 parent 0c0d4f2 commit 67ef51d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ajax-datatables-rails/datatable/column.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ def formated_value
6767
private
6868

6969
def type_cast
70-
DB_ADAPTER_TYPE_CAST[AjaxDatatablesRails.config.db_adapter] || 'VARCHAR'
70+
@type_cast ||= (DB_ADAPTER_TYPE_CAST[AjaxDatatablesRails.config.db_adapter] || 'VARCHAR')
7171
end
7272

7373
def casted_column
74-
::Arel::Nodes::NamedFunction.new('CAST', [table[field].as(type_cast)])
74+
@casted_column ||= ::Arel::Nodes::NamedFunction.new('CAST', [table[field].as(type_cast)])
7575
end
7676

7777
end

0 commit comments

Comments
 (0)