Forum: Ruby on Rails error_messages_for not working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sahil D. (Guest)
on 2009-06-06 11:17
(Received via mailing list)
Hi,

i am trying to save an object with 2 associated objects:
Organisation has_many :users
                      has_many :addresses

def new
  @org = Organisation.new
  @user = @org.users.build
  @address = @org.addresses.build
end

view:
 <%= error_messages_for 'organisation', 'user', 'address' %>

But, this shows me just the error messages for the organisation. and if
any
associated object's validation fails, it just shows me:

users is invalid
addresses is invalid

I haven't specified validates_associated, in any of the 3 models.
Am i doing something wrong?


Regards

--
Sahil
This topic is locked and can not be replied to.