Forum: Ruby on Rails ActiveRecord

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.
Christian G. (Guest)
on 2005-11-24 21:54
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
Warren S. (Guest)
on 2005-12-13 00:26
(Received via mailing list)
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.
Jason Terk (Guest)
on 2005-12-13 00:38
(Received via mailing list)
TextDrive (http://www.textdrive.com) is the "official" Ruby on Rails
host. I've had great experiences with them

--
http://scotchandpolitics.com
Ezra Z. (Guest)
on 2005-12-13 01:29
(Received via mailing list)
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)
>
> 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.

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...
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
removed_email_address@domain.invalid
Craig W. (Guest)
on 2005-12-13 01:29
(Received via mailing list)
On 12 Dec 2005, at 22:24, Warren S. wrote:
> 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.

Which country are they operating in?

Yours,
Craig
--
Craig W. | t: +44 (0)131 516 8595 | e: removed_email_address@domain.invalid
Xeriom.NET    | f: +44 (0)709 287 1902 | w: http://xeriom.net
Chris B. (Guest)
on 2005-12-13 01:35
(Received via mailing list)
On 12/12/05, Warren S. <removed_email_address@domain.invalid> 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
Alain R. (Guest)
on 2005-12-13 13:40
(Received via mailing list)
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-opti...



Alain
This topic is locked and can not be replied to.