Commit c553ad104fd36571b3725ba6206bccfd653833a3

Authored by Antonio Terceiro
1 parent 72d8ae0c

Remove catch-all rescue clause

It was masking a programming error, which is now fixed.
plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb
... ... @@ -114,7 +114,7 @@ class ShoppingCartPluginController < PublicController
114 114 :message => _('Request sent successfully. Check your email.'),
115 115 :error => {:code => 0}
116 116 }.to_json
117   - rescue Exception => exception
  117 + rescue ActiveRecord::ActiveRecordError
118 118 render :text => {
119 119 :ok => false,
120 120 :error => {
... ...
plugins/shopping_cart/lib/shopping_cart_plugin/cart_helper.rb
1 1 module ShoppingCartPlugin::CartHelper
2 2  
3 3 include ActionView::Helpers::NumberHelper
  4 + include ActionView::Helpers::TagHelper
4 5  
5 6 def sell_price(product)
6 7 return 0 if product.price.nil?
... ...
plugins/shopping_cart/lib/shopping_cart_plugin/mailer.rb
... ... @@ -12,7 +12,8 @@ class ShoppingCartPlugin::Mailer < Noosfero::Plugin::MailerBase
12 12 body :customer => customer,
13 13 :supplier => supplier,
14 14 :items => items,
15   - :environment => supplier.environment
  15 + :environment => supplier.environment,
  16 + :helper => self
16 17 end
17 18  
18 19 def supplier_notification(customer, supplier, items)
... ... @@ -25,6 +26,8 @@ class ShoppingCartPlugin::Mailer < Noosfero::Plugin::MailerBase
25 26 body :customer => customer,
26 27 :supplier => supplier,
27 28 :items => items,
28   - :environment => supplier.environment
  29 + :environment => supplier.environment,
  30 + :helper => self
  31 +
29 32 end
30 33 end
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
... ... @@ -35,7 +35,7 @@
35 35 </ul>
36 36  
37 37 <p><%=_('Here are the products you bought:')%></p>
38   - <%= items_table(@items, @supplier, true) %>
  38 + <%= @helper.items_table(@items, @supplier, true) %>
39 39  
40 40 <p>
41 41 --<br/>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
... ... @@ -33,7 +33,7 @@
33 33 </ul>
34 34  
35 35 <p><%=_('And here are the items bought by this customer:')%></p>
36   - <%= items_table(@items, @supplier, true) %>
  36 + <%= @helper.items_table(@items, @supplier, true) %>
37 37  
38 38 <p>
39 39 --<br/>
... ...