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