Is 'type' a reserved word?

I’d like to my a ‘type’ column in my database. Will this create a
problem? thanks.

1 Like

I’d like to my a ‘type’ column in my database. Will this create a
problem? thanks.

Yes, it’s used for STI. See here:


I think you can change it, but not sure how.

HTH,
Jordan

Yup it is. I’ve run into this quite a bit, I just name my columns
“type_of” now.

Not to be a curmudgeon, but it really is easy to just try using “type”
as a column name and see if you run into a problem. It probably takes
less time too.

I disagree. Asking this question creates additional documentation on the inter-webs about type being a reserved word in Rails. Moreover, it allows smart people like you to suggest good alternatives like type_of. Standing on the shoulders of giants…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs