TLDR; I think it would be a nice addition if rails can warn or raise when user attempts to do “rails generate scaffold” and a reserved word like class
is used.
Rails allows this:
bin/rails generate scaffold post title:string class:string
but later on when we try to Post.new
we get
irb(main):001:0> Post.new
/Users/administrator/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/rails-89fc4bf9196f/activerecord/lib/active_record/inheritance.rb:345:in `ensure_proper_type': undefined method `finder_needs_type_condition?' for nil:NilClass (NoMethodError)
if klass.finder_needs_type_condition?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
irb(main):002:0>
I think it would be a nice addition if rails can warn or raise when user attempts to do “rails generate scaffold” and a reserved word like class
is used.