1

I would like to change a column in the DB for the status of a package in my application, something like:

  • Pending ( should be default )
  • Cleared
  • Updated

The current column is boolean data type. I was thinking of changing to ENUM data type, but I'm not sure if that will be a good choice and how to go about it. Do you have any suggestions?

1 Answer 1

1

As per my knowledge this is what I would do.., For eg: In your DB

def change
create_table :statuses do |t|
  t.integer "status",:default => 1
end

end

and In model define your enum status

class Status<ActiveRecord::Base
  enum status {pending: 1, cleared: 2, updated: 3}
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.