ActiveRecord

Olá. Estou com problemas para tratar exceções em ruby.
Tenho duas validações no mesmo método, update. Validação de data e
validação de campo numérico. Porém somente a validação de data está
sendo efetivamente realizada.
Segue o código:
def update
begin
@guiaencamhospital = Guiaencamhospital.find(params[:id])

 @guiaencam = @guiaencamhospital.guiaencam
 @crianca = Crianca.find(@guiaencam.crianca_id)

 if 

@guiaencamhospital.guiaencam.update_attributes(params[:guiaencam]) and
@guiaencamhospital.update_attributes(params[:guiaencamhospital])
flash[:notice] = ‘Guia foi atualizado com sucesso.’
redirect_to :action => ‘show’, :id => @guiaencamhospital
else
@guiaencamhospital = Guiaencamhospital.find(params[:id])
@guiaencam = @guiaencamhospital.guiaencam
@crianca = Crianca.find(@guiaencam.crianca_id)
@medicos = Medico.find_all
render :action => ‘edit’
end

 @erro = error_message_on(@guiaencamhospital, update, prepend_text = 

“teste1”, append_text = “teste2”)

 rescue  ActiveRecord::MultiparameterAssignmentErrors
     @guiaencamhospital = Guiaencamhospital.find(params[:id])
     @guiaencam = @guiaencamhospital.guiaencam
     @crianca = Crianca.find(@guiaencam.crianca_id)
     @medicos = Medico.find_all
     render :action => 'edit'
     flash[:notice] = 'Erro: ' + @erro

end

end

Alguém sabe como eu posso fazer as duas validações de maneira separada,
tal que ambas possam ocorrer?

Obrigada

I need a couple of hosting recommendations from you folks:

  1. A really cheap and reliable RoR site for very-low volume
    demonstrations and such.
    Something under $10 per month with maybe a few users a day. I can put
    stuff there and use
    it to demonstrate web designs.

  2. A utilitarian RoR hosting/colo vendor for small online stores. Think
    “A 2-store chain”
    putting up it’s first online store. Small operations.

Warren S.

TextDrive (http://www.textdrive.com) is the “official” Ruby on Rails
host. I’ve had great experiences with them


http://scotchandpolitics.com

On Dec 12, 2005, at 2:24 PM, Warren S. wrote:

I need a couple of hosting recommendations from you folks:

  1. A really cheap and reliable RoR site for very-low volume
    demonstrations and such.
    Something under $10 per month with maybe a few users a day. I can
    put stuff there and use
    it to demonstrate web designs.

Textdrive.com, planetargon.com, dreamhost.com(cheaper but less quality)

  1. A utilitarian RoR hosting/colo vendor for small online stores.
    Think “A 2-store chain”
    putting up it’s first online store. Small operations.

rimuhosting.com has great VPS servers that run on the Xen platform. I
have written about them here:
http://brainspl.at/articles/2005/11/11/rails-vps-servers-at-
rimuhosting-com
http://brainspl.at/articles/2005/11/13/the-perfect-lightweight-rails-
lighttpd-debian-install

And rackforce.com has good deals on dedicated servers. Around $100
for your own dedicated server with root access and unlimited monthly
bandwidth on a fat 100mbit pipe.

Warren S.

Hope that helps you some. I host all of my rails sites on rimu or
rackforce these days.

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
[email protected]

On 12 Dec 2005, at 22:24, Warren S. wrote:

  1. A utilitarian RoR hosting/colo vendor for small online stores.
    Think “A 2-store chain”
    putting up it’s first online store. Small operations.

Which country are they operating in?

Yours,
Craig

Craig W. | t: +44 (0)131 516 8595 | e: [email protected]
Xeriom.NET | f: +44 (0)709 287 1902 | w: http://xeriom.net

On 12/12/05, Warren S. [email protected] wrote:

  1. A really cheap and reliable RoR site for very-low volume demonstrations and such.
    Something under $10 per month with maybe a few users a day. I can put stuff there and use
    it to demonstrate web designs.

A Small Orange:

http://asmallorange.com/services/hosting/

Highly recommended.


Chris B.

http://hypsometry.com/ : website edification
http://uvlist.org/ : free classifieds for the Upper Valley

Warren

> 1) A really cheap and reliable RoR site for very-low volume

demonstrations and such.
> Something under $10 per month with maybe a few users a day. I
can put stuff there and use
> it to demonstrate web designs.

69$ @ http://www.dreamhost.com/
You won’t find cheaper than dreamhost, and many users on this list say
that it rocks for them:
Enter the promocode
goodgood69
, and you’ll get a 50$ reduction on the yearly fee (119$ → 69$)

They have a wiki loaded with Rails info:
http://wiki.dreamhost.com/index.php/Ruby_on_Rails

bonuses:

  • You get a free domain - .com, .net, .org - registration, and there are
    no yearly fee, as long as you keep your account at dreamhost
  • You’ll get huge amount of disk space and bandwidth, and they’ll
    increase it every week.
  • They pledged in 1998 to never rise the fee.

note:
For optimal performance, read and apply the recipes found in :

http://weblog.textdrive.com/article/175/rails-optimizing-resource-usage

Alain