[Nitro] [NP.ORG] Nitro/Og Fora daily diggest

george.moschovitis at gmail.com george.moschovitis at gmail.com
Thu Mar 22 20:05:01 EDT 2007


>From judson.myopenid.com 
Date: Thu Mar 22 18:25:50 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/54
Message-ID: http://www.nitroproject.org/fora/posts/view/57

Change the conditional to a rescue, thus:

<code>begin
  obj.save
rescue Og::ValidationException
  flash[:msg] = obj.validation_errors
  redirect :error
else
  flash[:msg] = "everything ok" 
  redirect :ok
end
</code>

That way you cannot fail to save data without knowing that you're doing it.  There could even be a subclass of ValidationException for each validator, so that you could control behavior based on which validation had failed.

>From gmosx.myopenid.com 
Date: Thu Mar 22 07:59:02 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/54
Message-ID: http://www.nitroproject.org/fora/posts/view/56

I am aware of this 'bug'. The problem is I am not sure how the behaviour should be altered. The current implementation allows code like this:

<code>
unless obj.save
  flash[:msg] = obj.validation_errors
  redirect :error
else
  flash[:msg] = "everything ok"
  redirect :ok
end
</code>

I am not sure which is the best way to alter the current interface. Any ideas?

regards,
George.

>From gmosx.myopenid.com 
Date: Thu Mar 22 07:55:19 UTC 2007
Subject: RE: 
In-Reply-To: http://www.nitroproject.org/fora/posts/view/52
Message-ID: http://www.nitroproject.org/fora/posts/view/55

<blockquote>And I think there might be the possibility of table name collision</blockquote>

That's why I included the prefix initially. But perhapswe could skip the prefix and specially handle the collision cases.

-g.




--
This mail is automatically generated from the http://nitroproject.org/fora
digest robot. It presents the discussions in the fora during the last 24 hours.
Do not reply to this email.


More information about the Nitro-general mailing list