Created
February 17, 2012 10:00
-
-
Save gumayunov/1852323 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plan.allow? "Business", :add_photos, :subject => business | |
# если в качестве неймспейса передана не строка и не символ то | |
# неймспейсом берется класс объекта и он же подставляется как subject | |
plan.allow? business, :add_photos | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asserts do | |
# :subject можно не указывать в принимаемых параметрах. | |
assert :review_photos_limit, [:limit] do | |
subject.photos.size <= limit | |
end | |
end | |
namespace "Business" do | |
# Для тарифа :bouquet нет ограничения | |
feature :add_photos, [:bouquet] do | |
assert :photos_limit, :bulb, :limit => 1 | |
assert :photos_limit, :flower, :limit => 5 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment