Skip to content

Commit

Permalink
Merge pull request #3413 from jdufresne/citext
Browse files Browse the repository at this point in the history
Add support for PostgreSQL citext data type
  • Loading branch information
mshibuya committed Nov 16, 2021
2 parents e9e6908 + efe07f7 commit 53ef1e5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/assets/javascripts/rails_admin/ra.filter-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
)
);
break;
case "citext":
case "string":
case "text":
case "belongs_to_association":
Expand Down
2 changes: 1 addition & 1 deletion lib/rails_admin/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def build_statement_for_type
case @type
when :boolean then build_statement_for_boolean
when :integer, :decimal, :float then build_statement_for_integer_decimal_or_float
when :string, :text then build_statement_for_string_or_text
when :string, :text, :citext then build_statement_for_string_or_text
when :enum then build_statement_for_enum
when :belongs_to_association then build_statement_for_belongs_to_association
when :uuid then build_statement_for_uuid
Expand Down
1 change: 1 addition & 0 deletions lib/rails_admin/config/fields/types/all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@
require 'rails_admin/config/fields/types/json'
require 'rails_admin/config/fields/types/inet'
require 'rails_admin/config/fields/types/uuid'
require 'rails_admin/config/fields/types/citext'
13 changes: 13 additions & 0 deletions lib/rails_admin/config/fields/types/citext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rails_admin/config/fields/types/text'

module RailsAdmin
module Config
module Fields
module Types
class Citext < Text
RailsAdmin::Config::Fields::Types.register(:citext, self)
end
end
end
end
end
7 changes: 7 additions & 0 deletions spec/rails_admin/config/fields/types/citext_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'

RSpec.describe RailsAdmin::Config::Fields::Types::Citext do
it_behaves_like 'a generic field type', :string_field

it_behaves_like 'a string-like field type', :string_field
end

0 comments on commit 53ef1e5

Please sign in to comment.