iangreenleaf / native_enum

Adds ENUM and SET support to ActiveRecord
MIT License
21 stars 21 forks source link

Rails 5.1 validation problems #16

Open peterwake opened 6 years ago

peterwake commented 6 years ago

@mcls @iangreenleaf just FYI I tried this gem with Rails 5.1, (and also with your new Rails 5.1 branch), and was getting ActiveRecord Validation failed errors on my models (which I don't get using the original). This is occuring where I had e.g.

belongs_to :communication

Which I could solve by adding

belongs_to :communication, optional: true

However for models where I have

class Communication < ApplicationRecord

  has_many :communications_stores

  has_many :stores, -> { distinct },
    through: :communications_stores

And I do

Communication.create(stores: stores)

It blew up. I couldn't work out how to stop it throwing the error in this case.