Skip to content

Commit

Permalink
Merge pull request #24 from performant-software/feature/udf23_field_o…
Browse files Browse the repository at this point in the history
…rder

UDF #23 - Field order
  • Loading branch information
dleadbetter authored Oct 26, 2022
2 parents 8e3a6ef + d41ba65 commit 3ee864c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/user_defined_fields/user_defined_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UserDefinedField < ApplicationRecord
belongs_to :defineable, polymorphic: true, optional: true

# Resourceable parameters
allow_params :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, options: []
allow_params :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, :order, options: []

# Constants
DATA_TYPES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module UserDefinedFields
class UserDefinedFieldsSerializer < BaseSerializer
index_attributes :id, :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, :options
show_attributes :id, :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, :options
index_attributes :id, :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, :options, :order
show_attributes :id, :table_name, :column_name, :data_type, :required, :searchable, :allow_multiple, :options, :order
end
end
9 changes: 9 additions & 0 deletions db/migrate/20221025201735_add_order_to_user_defined_fields.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddOrderToUserDefinedFields < ActiveRecord::Migration[7.0]
def up
add_column :user_defined_fields_user_defined_fields, :order, :integer, null: false, default: 0
end

def down
remove_column :user_defined_fields_user_defined_fields, :order
end
end

0 comments on commit 3ee864c

Please sign in to comment.