I could solve the problem the following way. But I dont know whether 
this the right approach.Please correct if wrong

> module ActiveRecord::Validations::ClassMethods
>   def validates_associated(*associations)
>       associations.each do |association|
>         class_eval do
>           validates_each(associations) do |record, associate_name, 
> value|
>             associates = record.send(associate_name)
>             associates = [associates] unless 
> associates.respond_to?('each')
>             associates.each do |associate|
>               if associate && !associate.valid?
>                 associate.errors.each do |key, value|
                    humanized_columns = {:address_city => 
"City",:phone_oofice => "Office Phone Number"}
                    record.errors.add(key, value,{:attribute => 
humanized[key.to_sym] || human_attribute_name(key.to_s)})
>                 end
>               end
>             end
>           end
>         end
>       end
>   end
> end


Thanks
Tom
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to