I have a model "User" that up until now didn't have any issues. I added some validations and noticed that I no longer could add any new Users - the record would be rolled back. So I removed the validations, but my records were still being rolled back. So I eliminated literally all the code from my model file so all it contains is this:
class User < ActiveRecord::Base
end
> User.create(name: "test")
(0.6ms) BEGIN
(2.3ms) ROLLBACK
#=> #<User id: nil, name: "test", (et cetera)>
blacklist = ['home'].freeze
validates :name, exclusion: {in: blacklist}
@user.errors
Try this:
user = User.new(name: "test")
user.save
user.errors # This should contain the errors that prevented your object from being saved.