Skip to content

Commit 63e48b4

Browse files
committed
Remove payer_is_team_admin
1 parent 2c8ba62 commit 63e48b4

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

app/models/plan.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,6 @@ def unregister_from_stripe
114114

115115
#TODO CHANGE with default in rails 4
116116
def generate_public_id
117-
self.public_id = public_id || SecureRandom.urlsafe_base64(4).downcase
117+
self.public_id ||= SecureRandom.urlsafe_base64(4).downcase
118118
end
119119
end

app/models/teams/account.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,9 @@ class Teams::Account < ActiveRecord::Base
2121
validates_presence_of :stripe_card_token
2222
validates_presence_of :stripe_customer_token
2323
validates :team_id, presence: true, uniqueness: true
24-
validate :admin_id, :payer_is_team_admin
2524

2625
attr_protected :stripe_customer_token, :admin_id
2726

28-
def payer_is_team_admin
29-
if admin_id.nil? #or !team.admin?(admin)
30-
errors.add(:admin_id, "must be team admin to create an account")
31-
end
32-
end
33-
3427
def subscribe_to!(plan, force=false)
3528
self.plan_ids = [plan.id]
3629
if force || update_on_stripe(plan)
@@ -46,7 +39,7 @@ def save_with_payment(plan=nil)
4639
if stripe_card_token
4740
create_customer unless plan.try(:one_time?)
4841
subscribe_to!(plan) unless plan.nil?
49-
self.save!
42+
save!
5043
return true
5144
else
5245
return false

0 commit comments

Comments
 (0)