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

Closed
rafaelfranca opened this Issue Mar 14, 2014 · 0 comments

Comments

Projects
None yet
2 participants
Owner

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
event.valid?

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.
e700ea2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment