[Ovirt-devel] [PATCH server] fix for BZ #477796: pool name uniqueness

Jason Guiditta jason.guiditta at gmail.com
Thu May 28 15:47:41 UTC 2009


ACK, I now get the expected 'name already taken' error.

On Fri, May 22, 2009 at 12:37 PM, Scott Seago <sseago at redhat.com> wrote:

> We already had the validation rule in place, but the way the
> betternestedset API sets the parent_id the rules were being bypassed.
>
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
>  src/app/models/pool.rb |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
> index 2979fcb..0a63723 100644
> --- a/src/app/models/pool.rb
> +++ b/src/app/models/pool.rb
> @@ -65,6 +65,9 @@ class Pool < ActiveRecord::Base
>     transaction do
>       save!
>       move_to_child_of(parent)
> +      # second save! call is to trigger validation rules related to
> parent_id
> +      # since this nested set API call bypasses the standard AR validation
> +      save!
>       parent.permissions.each do |permission|
>         new_permission = Permission.new({:pool_id     => id,
>                                          :uid         => permission.uid,
> --
> 1.6.0.6
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090528/f3589bc2/attachment.htm>


More information about the ovirt-devel mailing list