On 10/14/10 - 03:01:32PM, Chris Lalancette wrote: > On 10/13/10 - 02:43:23PM, [email protected] wrote: > > From: Jan Provaznik <[email protected]> > > > > Template model checks uniqueness of template name > > --- > > src/app/models/template.rb | 1 + > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > > diff --git a/src/app/models/template.rb b/src/app/models/template.rb > > index dec7b4b..25b1661 100644 > > --- a/src/app/models/template.rb > > +++ b/src/app/models/template.rb > > @@ -13,6 +13,7 @@ class Template < ActiveRecord::Base > > # so there can be situation when save is called and name and platform > > can be > > # unset) > > validates_presence_of :name > > + validates_uniqueness_of :name > > validates_presence_of :platform > > validates_presence_of :platform_version > > validates_presence_of :architecture > > ACK, and pushed.
Arg, this was premature. There are two problems: 1) With this patch in place, the template page does indeed throw a uniqueness error. However, the error message is very ugly: 1 error prohibited this tpl from being saved At the very least "tpl" should be "template". 2) Even though the Template page throws an error, the duplicate image is added to the database anyway. So you still get the confusing behavior, made even more confusing by the fact that it seemed to fail but actually succeeded. -- Chris Lalancette _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
