Skip to content

Commit f433d23

Browse files
committed
Merge pull request Crowdtilt#194 from Crowdtilt/settings_and_alert_fix
Fix finding Settings by hardcoded ID and move alert to the flash hash when displaying
2 parents d101a46 + 6a2f579 commit f433d23

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

app/models/campaign.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def expiration_date_cannot_be_in_the_past
112112
end
113113

114114
def payments_can_be_activated
115-
if self.production_flag && !Settings.find_by_id(1).payments_activated?
115+
if self.production_flag && !Settings.first.payments_activated?
116116
errors.add(:base, "cannot activate payments")
117117
end
118118
end

app/views/layouts/application.html.erb

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
<%= render 'layouts/social_js' %>
2121
<%= render 'layouts/navbar' %>
2222
<%= render 'theme/views/header' %>
23-
<% flash.to_hash().slice(:success, :info, :notice, :error).each do |key, value| %>
23+
<% flash.to_hash().slice(:success, :info, :notice, :error, :alert).each do |key, value| %>
2424
<% if !value.blank? %><div class="alert alert-<%= key %>"><%= value %></div><% end %>
2525
<% end %>
2626
<div id="main">
27-
<% if alert %>
28-
<p class="admin-alert alert alert-error"><%= alert %></p>
29-
<% end %>
3027
<%= yield %>
3128
</div>
3229
<%= render 'theme/views/footer' %>

lib/tasks/sync_payments.rake

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ namespace :ch do
99
campaign = Campaign.find_by_ct_campaign_id(ENV['CAMPAIGN_ID'])
1010
if campaign
1111
puts "Synching payments for #{campaign.name} (#{ENV['CAMPAIGN_ID']})"
12-
campaign.production_flag ? Crowdtilt.production(Settings.find_by_id(1)) : Crowdtilt.sandbox
12+
campaign.production_flag ? Crowdtilt.production(Settings.first) : Crowdtilt.sandbox
1313
begin
1414
response = Crowdtilt.get("campaigns/#{campaign.ct_campaign_id}/payments?page=1&per_page=100")
1515
rescue => exception
1616
puts exception.message and abort
17-
end
17+
end
1818
ct_payments = response['payments']
1919
pages = response['pagination']['total_pages']
2020

0 commit comments

Comments
 (0)