Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Regression with HABTM and validade: false #14383

rafaelfranca opened this Issue Mar 14, 2014 · 0 comments


None yet
2 participants

rafaelfranca commented Mar 14, 2014

Reported by @tanelj.

It seems that there are still some issues with HABTM.

In Rail 4.1.0.rc1 (and in current 4.1 master) HABTM does not respect validate: false:

has_and_belongs_to_many :languages, validate: false

Currently validation is always called for associated objects.

For example this code is calling validation (on: :create) for language object even when validate: false:

event = Event.new
event.languages << Language.first

Here is minitest about the issue: https://gist.github.com/tanelj/9517608

It works fine in Rails 4.0.3.

cc @tenderlove

@rafaelfranca rafaelfranca added this to the 4.1.0 milestone Mar 14, 2014

@carlosantoniodasilva carlosantoniodasilva added a commit to carlosantoniodasilva/rails that referenced this issue Mar 14, 2014

@carlosantoniodasilva carlosantoniodasilva Obey `validate: false` option for habtm
Fixes #14383.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment