0

I want to know if there is a best to name model attribute that won't conflict with ActiveRecord::Base instance methods.

For example, we probably won't name attribute as class or toggle, since these names have already been taken. But how do I simply know if the name is conflicted when generating a model? Any ideas?

Weihang Jian
  • 7,826
  • 4
  • 44
  • 55

1 Answers1

3

Fire your console at first

 > a = MyModel.new
 > a.methods.grep(/my_attr/)

If nothing, nice, you can use my_attr

Billy Chan
  • 24,625
  • 4
  • 52
  • 68