[issue #279] Removed can_clone? and can_build? from Product

This commit is contained in:
George Vinogradov 2012-03-16 01:10:24 +04:00
parent 548550d355
commit 9911d9f25e
2 changed files with 1 additions and 12 deletions

View File

@ -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

View File

@ -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