...............................................................................................................................................
...............................................................................................................................................
class AddExecuteOnToApprovals < ActiveRecord::Migration[6.0]
def change
unless ActiveRecord::Base.connection.column_exists?(:approvals, :execute_on)
add_column :approvals, :execute_on, :string, default: [], array: true
end
end
end
...............................................................................................................................................
def approval_params
params.require(:approval).permit(:menu_id, :date_created, :approval_name, :description, :status, :rule_criteria_id,execute_on: [])
end
...............................................................................................................................................
give input by the poostman
{
"approval":{
"menu_id":12,
"date_created": "25/07/2022",
"workflow_name": "academic_account",
"execute_on": ["record_edit"],
"description": "work flow description for fee structure",
"status": "not_approved",
"rule_criteria_id": 18
}
...............................................................................................................................................
class ChangeAddArrayToApprovals < ActiveRecord::Migration[6.0]
def change
if ActiveRecord::Base.connection.column_exists?(:approvals, :execute_on)
remove_column :approvals, :execute_on, :string
end
end
end
...............................................................................................................................................
create_table "approvals", force: :cascade do |t|
t.integer "menu_id"
t.datetime "date_created"
t.string "approval_name"
t.text "description"
t.integer "status"
t.integer "rule_criteria_id"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.string "execute_on", default: [], array: true
end
Comments
Post a Comment