validates_associated in production

Posted by Rien on Stack Overflow See other posts from Stack Overflow or by Rien
Published on 2010-04-02T09:18:03Z Indexed on 2010/04/02 9:23 UTC
Read the original article Hit count: 494

Hi all. Imagine a simple model.

class Service
  belongs_to :user
  validates_associated :user
  accepts_nested_attributes_for :user
end

Nothing special right? The validations on the associated User model trigger correctly in development mode. But don't do anything in production. I've added a validates_on_presence :user just like the docs say. This triggers when there's no User associated with the Service, but fill in one thing on the User model and nothing happens! It's driving me up the walls. Am I overlooking something?

More info about the MVC: I use formtastic for the forms.

Thanks!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about validation