From 9911d9f25e73278843e7643f05ccb7a36f23826e Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Fri, 16 Mar 2012 01:10:24 +0400 Subject: [PATCH] [issue #279] Removed can_clone? and can_build? from Product --- app/models/ability.rb | 2 +- app/models/product.rb | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 64e9acbbb..562a1974e 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -92,7 +92,7 @@ class Ability can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.platform_type == 'main'} can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform } - can(:create, ProductBuildList) {|pbl| pbl.product.can_build? and can?(:update, pbl.product)} + can(:create, ProductBuildList) {|pbl| can?(:update, pbl.product)} can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)} can [:read, :platforms], Category diff --git a/app/models/product.rb b/app/models/product.rb index 7d703b76d..38dc0a324 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -23,18 +23,7 @@ class Product < ActiveRecord::Base @delete_tar = value end - def can_clone? - #is_template - false - end - - def can_build? -# !is_template - true - end - def clone_from!(template) - raise "Only templates can be cloned" unless template.can_clone? attrs = ATTRS_TO_CLONE.inject({}) {|result, attr| result[attr] = template.send(attr) result