Check for Errors

in the application.rhtml I am trying to check and see if any of the
models associated with this controller have errors (i.e. -
model.errors.count > 0). Does anyone know how to do that using
reflection or something since I will not know what models are present
in this controller or action of the controller since it is in the
shared application.rhtml file??

Thanks!

In your controller you could define a flash message:

def create
@thing = Thing.new(params[:thing])
if @thing.save
flash[:notice] = “Thing was saved correctly.”
else
flash[:notice] = “Thing could not be saved: #{@thing.errors.to_s}”
end
end

On Jan 31, 2008 1:05 PM, Tim [email protected] wrote:


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.