Commit 75e6eb59ecd21735c87eb53eb68d510760580b3f
1 parent
4eb7d82a
Exists in
master
and in
4 other branches
patch rails to ignore text limit
Showing
1 changed file
with
26 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) | ||
2 | + class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | ||
3 | + class TableDefinition | ||
4 | + def text(*args) | ||
5 | + options = args.extract_options! | ||
6 | + options.delete(:limit) | ||
7 | + column_names = args | ||
8 | + type = :text | ||
9 | + column_names.each { |name| column(name, type, options) } | ||
10 | + end | ||
11 | + end | ||
12 | + | ||
13 | + def add_column_with_limit_filter(table_name, column_name, type, options = {}) | ||
14 | + options.delete(:limit) if type == :text | ||
15 | + add_column_without_limit_filter(table_name, column_name, type, options) | ||
16 | + end | ||
17 | + | ||
18 | + def change_column_with_limit_filter(table_name, column_name, type, options = {}) | ||
19 | + options.delete(:limit) if type == :text | ||
20 | + change_column_without_limit_filter(table_name, column_name, type, options) | ||
21 | + end | ||
22 | + | ||
23 | + alias_method_chain :add_column, :limit_filter | ||
24 | + alias_method_chain :change_column, :limit_filter | ||
25 | + end | ||
26 | +end |