shop_bunny 0.7.4.13 → 0.7.4.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,16 +34,17 @@ module ShopBunny
34
34
 
35
35
  def update
36
36
  @cart.update_attributes(params[:cart])
37
+ @cart.update_automatic_coupons!
37
38
  respond_with @cart do |format|
38
- format.html {
39
+ format.html {
39
40
  if @cart.errors.any?
40
- render 'show'
41
+ render 'show'
41
42
  else
42
43
  # We have to redirect by hand here, because
43
44
  # url_for(@cart) returns "/cart.x" when cart is a singular resource
44
45
  # (see routes.rb). This is a known limitation of Rails.
45
46
  # See https://rails.lighthouseapp.com/projects/8994/tickets/4168
46
- redirect_to :action => :show
47
+ redirect_to :action => :show
47
48
  end
48
49
  }
49
50
  end
@@ -92,12 +92,12 @@ module ShopBunny
92
92
  cart_item.save!
93
93
  self.reload
94
94
  end
95
-
95
+
96
96
  update_automatic_coupons!
97
-
97
+
98
98
  cart_item
99
99
  end
100
-
100
+
101
101
  def shipping_cost_calculator
102
102
  ShopBunny.shipping_cost_calculator
103
103
  end
@@ -137,22 +137,21 @@ module ShopBunny
137
137
  )
138
138
  }
139
139
  end
140
-
141
- protected
142
-
140
+
143
141
  def update_automatic_coupons!
144
142
  coupon_uses.each do |use|
145
143
  use.destroy if use.coupon.value_of_automatic_add
146
144
  end
147
-
145
+
148
146
  save!
149
147
  reload
150
-
148
+
151
149
  Coupon.valid.automatically_added_over(item_sum).each do |coupon|
152
150
  coupons << coupon
153
151
  end
154
152
  end
155
-
153
+
154
+ protected
156
155
  def update_coupons
157
156
  Array(@coupon_code).each { |code|
158
157
  coupon = Coupon.find_by_code(code)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shop_bunny
3
3
  version: !ruby/object:Gem::Version
4
- hash: 125
4
+ hash: 123
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
9
  - 4
10
- - 13
11
- version: 0.7.4.13
10
+ - 14
11
+ version: 0.7.4.14
12
12
  platform: ruby
13
13
  authors:
14
14
  - kopfmaschine.com
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-25 00:00:00 +01:00
19
+ date: 2010-11-26 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -30,34 +30,34 @@ extensions: []
30
30
  extra_rdoc_files: []
31
31
 
32
32
  files:
33
- - lib/generators/shop_bunny/install_generator.rb
34
- - lib/generators/shop_bunny/templates/shopbunny_controller_template.rb
35
33
  - lib/generators/shop_bunny/templates/shopbunny_model_template.rb
34
+ - lib/generators/shop_bunny/templates/shopbunny_controller_template.rb
35
+ - lib/generators/shop_bunny/install_generator.rb
36
+ - lib/shop_bunny.rb
36
37
  - lib/shop_bunny/cart_controller_module.rb
37
38
  - lib/shop_bunny/cart_module.rb
38
- - lib/shop_bunny/engine.rb
39
39
  - lib/shop_bunny/shipping_cost_calculator.rb
40
- - lib/shop_bunny.rb
41
- - app/controllers/application_controller.rb
42
- - app/controllers/carts_controller.rb
40
+ - lib/shop_bunny/engine.rb
41
+ - app/views/carts/show.html.erb
43
42
  - app/models/cart.rb
43
+ - app/models/coupon_use.rb
44
44
  - app/models/cart_item.rb
45
45
  - app/models/coupon.rb
46
- - app/models/coupon_use.rb
47
46
  - app/models/item.rb
48
- - app/views/carts/show.html.erb
49
- - db/migrate/20100902115627_create_carts.rb
50
- - db/migrate/20100902115757_create_cart_items.rb
51
- - db/migrate/20100915073016_create_items.rb
47
+ - app/controllers/application_controller.rb
48
+ - app/controllers/carts_controller.rb
49
+ - db/migrate/20101125151017_change_valid_from_and_until_to_datetime_on_coupons.rb
50
+ - db/migrate/20100915162029_remove_owner_id_from_carts.rb
52
51
  - db/migrate/20100915091059_create_coupons.rb
52
+ - db/migrate/20101125140137_add_value_of_automatic_add_to_coupons.rb
53
+ - db/migrate/20100915073016_create_items.rb
54
+ - db/migrate/20100902115627_create_carts.rb
53
55
  - db/migrate/20100915093821_create_coupon_uses.rb
54
- - db/migrate/20100915162029_remove_owner_id_from_carts.rb
55
56
  - db/migrate/20100916194407_set_default_column_value_for_cart_items_quantity.rb
56
- - db/migrate/20101125140137_add_value_of_automatic_add_to_coupons.rb
57
- - db/migrate/20101125151017_change_valid_from_and_until_to_datetime_on_coupons.rb
57
+ - db/migrate/20100902115757_create_cart_items.rb
58
58
  - config/initializers/add_cart_finder_to_controllers.rb
59
- - config/initializers/machinist.rb
60
59
  - config/initializers/shop_bunny.rb
60
+ - config/initializers/machinist.rb
61
61
  - config/routes.rb
62
62
  has_rdoc: true
63
63
  homepage: http://kopfmaschine.com