app/models/kits/membership_kit.rb in artfully_ose-1.2.0 vs app/models/kits/membership_kit.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -1,26 +1,30 @@
class MembershipKit < Kit
include ActionView::Helpers::SanitizeHelper
acts_as_kit :with_approval => true, :admin_only => true do
- approve :unless => :no_bank_account?
-
self.configurable = true
- state_machine do
- state :cancelled, :enter => :kit_cancelled
- end
+ #
+ # So, this is horrible. Sorry.
+ # Leaving "approve" out of this list sets the kit to auto-approve which is the
+ # opposite of what we want. So, this kludge is here to force the kit to
+ # never approve until you call kit.admin_approve
+ #
+ approve :if => :dont_approve
+ admin_approve :unless => :no_bank_account?
when_active do |organization|
organization.can :access, :membership
end
end
before_save :initialize_accessors
before_save :sanitize_accessors
- ACCESSORS = [ :marketing_copy_heading, :marketing_copy_sidebar, :limit_per_transaction ]
+ ACCESSORS = [ :marketing_copy_heading, :marketing_copy_sidebar, :limit_per_transaction,
+ :membership_storefront ]
ACCESSORS.each do |accessor|
attr_accessible accessor
end
@@ -56,7 +60,11 @@
def sanitize_accessors
ACCESSORS.each do |accessor|
self.send("#{accessor}=", (sanitize self.send(accessor)))
end
+ end
+
+ def has_active_storefront?
+ self.membership_storefront == '1' || self.membership_storefront == 1
end
end
\ No newline at end of file