money-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +19 -0
- data/README.md +59 -5
- data/Rakefile +20 -0
- data/lib/generators/money_rails/initializer_generator.rb +15 -0
- data/lib/generators/templates/money.rb +29 -0
- data/lib/money-rails.rb +7 -1
- data/lib/money-rails/active_record/monetizable.rb +78 -0
- data/lib/money-rails/configuration.rb +33 -0
- data/lib/money-rails/orms.rb +29 -0
- data/lib/money-rails/railtie.rb +1 -3
- data/lib/money-rails/version.rb +1 -1
- data/money-rails.gemspec +2 -2
- data/spec/config_spec.rb +15 -0
- data/spec/dummy/config/initializers/money.rb +27 -1
- data/spec/dummy/log/test.log +377 -0
- data/spec/monetize_spec.rb +19 -1
- metadata +11 -3
- data/lib/money-rails/monetize.rb +0 -69
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.2.0
|
4
|
+
|
5
|
+
- Add new generator to install money.rb initializer
|
6
|
+
- Create a structure to enable better ORM/ODM integration
|
7
|
+
- Add configuration for numericality validation of monetized fields
|
8
|
+
- Add support for custom currency registration
|
9
|
+
|
10
|
+
## 0.1.0
|
11
|
+
|
12
|
+
- Use better names for args :target_name, :field_currency,
|
13
|
+
:model_currency. From now on, :as, :with_currency and :with_model_currency should
|
14
|
+
be used instead of the old ones which are deprecated. (GH-6)
|
15
|
+
|
16
|
+
## 0.0.1
|
17
|
+
|
18
|
+
- Hello World
|
19
|
+
|
data/README.md
CHANGED
@@ -24,6 +24,14 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
$ gem install money-rails
|
26
26
|
|
27
|
+
You may also install money configuration initializer:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ rails g money_rails:initializer
|
31
|
+
```
|
32
|
+
|
33
|
+
There, you can define the default currency value and set other
|
34
|
+
configuration parameters for the rails app.
|
27
35
|
|
28
36
|
## Usage
|
29
37
|
|
@@ -49,11 +57,11 @@ money attribute, then you can provide ```as``` argument with a string
|
|
49
57
|
value to the ```monetize``` macro:
|
50
58
|
|
51
59
|
```ruby
|
52
|
-
monetize :
|
60
|
+
monetize :discount_subunit, :as => "discount"
|
53
61
|
```
|
54
62
|
|
55
|
-
Now the model objects will have a ```
|
56
|
-
is a Money object, wrapping the value of ```
|
63
|
+
Now the model objects will have a ```discount``` attribute which
|
64
|
+
is a Money object, wrapping the value of ```discount_subunit``` column to a
|
57
65
|
Money instance.
|
58
66
|
|
59
67
|
### Field currencies
|
@@ -61,12 +69,58 @@ Money instance.
|
|
61
69
|
You can define a specific currency per monetized field:
|
62
70
|
|
63
71
|
```ruby
|
64
|
-
monetize :
|
72
|
+
monetize :discount_subunit, :as => "discount", :with_currency => :eur
|
65
73
|
```
|
66
74
|
|
67
|
-
Now ```
|
75
|
+
Now ```discount_subunit``` will give you a Money object using EUR as
|
68
76
|
currency.
|
69
77
|
|
78
|
+
### Configuration parameters
|
79
|
+
|
80
|
+
You can handle a bunch of configuration params through ```money.rb``` initializer:
|
81
|
+
|
82
|
+
```
|
83
|
+
MoneyRails.configure do |config|
|
84
|
+
|
85
|
+
# To set the default currency
|
86
|
+
#
|
87
|
+
config.default_currency = :usd
|
88
|
+
|
89
|
+
# To handle the inclusion of validations for monetized fields
|
90
|
+
# The default value is true
|
91
|
+
#
|
92
|
+
config.include_validations = true
|
93
|
+
|
94
|
+
# Register a custom currency
|
95
|
+
#
|
96
|
+
# config.register_currency = {
|
97
|
+
# :priority => 1,
|
98
|
+
# :iso_code => "EU4",
|
99
|
+
# :name => "Euro with subunit of 4 digits",
|
100
|
+
# :symbol => "€",
|
101
|
+
# :symbol_first => true,
|
102
|
+
# :subunit => "Subcent",
|
103
|
+
# :subunit_to_unit => 10000,
|
104
|
+
# :thousands_separator => ".",
|
105
|
+
# :decimal_mark => ","
|
106
|
+
# }
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
110
|
+
* default_currecy: Set the default (application wide) currency (USD is the default)
|
111
|
+
* include_validations: Permit the inclusion of a ```validates_numericality_of```
|
112
|
+
validation for each monetized field (the default is true)
|
113
|
+
* register_currency: Register one custom currency. This option can be
|
114
|
+
used more than once to set more custom currencies. The value should be
|
115
|
+
a hash of all the necessary key/value pairs (important keys: :priority, :iso_code, :name,
|
116
|
+
:symbol, :symbol_first, :subunit, :subunit_to_unit, :thousands_separator, :decimal_mark).
|
117
|
+
|
118
|
+
## Maintainers
|
119
|
+
|
120
|
+
* Andreas Loupasakis (https://github.com/alup)
|
121
|
+
* Shane Emmons (https://github.com/semmons99)
|
122
|
+
* Simone Carletti (https://github.com/weppos)
|
123
|
+
|
70
124
|
## License
|
71
125
|
|
72
126
|
MIT License. Copyright 2012 RubyMoney.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
begin
|
7
|
+
Bundler.setup(:default, :development)
|
8
|
+
rescue Bundler::BundlerError => e
|
9
|
+
$stderr.puts e.message
|
10
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
11
|
+
exit e.status_code
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rake'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
|
17
|
+
RSpec::Core::RakeTask.new
|
18
|
+
|
19
|
+
task :default => :spec
|
20
|
+
task :test => :spec
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module MoneyRails
|
2
|
+
module Generators
|
3
|
+
class InitializerGenerator < ::Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path("../../templates", __FILE__)
|
6
|
+
|
7
|
+
desc 'Creates a sample MoneyRails initializer.'
|
8
|
+
|
9
|
+
def copy_initializer
|
10
|
+
copy_file 'money.rb', 'config/initializers/money.rb'
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding : utf-8
|
2
|
+
|
3
|
+
MoneyRails.configure do |config|
|
4
|
+
|
5
|
+
# To set the default currency
|
6
|
+
#
|
7
|
+
#config.default_currency = :usd
|
8
|
+
|
9
|
+
# To handle the inclusion of validations for monetized fields
|
10
|
+
# The default value is true
|
11
|
+
#
|
12
|
+
#config.include_validations = true
|
13
|
+
|
14
|
+
# Register a custom currency
|
15
|
+
#
|
16
|
+
# Example:
|
17
|
+
# config.register_currency = {
|
18
|
+
# :priority => 1,
|
19
|
+
# :iso_code => "EU4",
|
20
|
+
# :name => "Euro with subunit of 4 digits",
|
21
|
+
# :symbol => "€",
|
22
|
+
# :symbol_first => true,
|
23
|
+
# :subunit => "Subcent",
|
24
|
+
# :subunit_to_unit => 10000,
|
25
|
+
# :thousands_separator => ".",
|
26
|
+
# :decimal_mark => ","
|
27
|
+
# }
|
28
|
+
|
29
|
+
end
|
data/lib/money-rails.rb
CHANGED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
require 'active_support/core_ext/array/extract_options'
|
3
|
+
require 'active_support/deprecation/reporting'
|
4
|
+
|
5
|
+
module MoneyRails
|
6
|
+
module ActiveRecord
|
7
|
+
module Monetizable
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def monetize(field, *args)
|
12
|
+
options = args.extract_options!
|
13
|
+
|
14
|
+
# Stringify model field name
|
15
|
+
subunit_name = field.to_s
|
16
|
+
|
17
|
+
if options[:field_currency] || options[:target_name] ||
|
18
|
+
options[:model_currency]
|
19
|
+
ActiveSupport::Deprecation.warn("You are using the old " \
|
20
|
+
"argument keys of monetize command! Instead use :as, " \
|
21
|
+
":with_currency or :with_model_currency")
|
22
|
+
end
|
23
|
+
|
24
|
+
# Model currency field name
|
25
|
+
model_currency_name = options[:with_model_currency] ||
|
26
|
+
options[:model_currency] || "currency"
|
27
|
+
|
28
|
+
# Override Model and default currency
|
29
|
+
field_currency_name = options[:with_currency] ||
|
30
|
+
options[:field_currency] || nil
|
31
|
+
|
32
|
+
name = options[:as] || options[:target_name] || nil
|
33
|
+
|
34
|
+
# Form target name for the money backed ActiveModel field:
|
35
|
+
# if a target name is provided then use it
|
36
|
+
# if there is a "_cents" suffix then just remove it to create the target name
|
37
|
+
# if none of the previous is the case then use a default suffix
|
38
|
+
if name
|
39
|
+
name = name.to_s
|
40
|
+
elsif subunit_name =~ /_cents$/
|
41
|
+
name = subunit_name.sub(/_cents$/, "")
|
42
|
+
else
|
43
|
+
# FIXME: provide a better default
|
44
|
+
name = subunit_name << "_money"
|
45
|
+
end
|
46
|
+
|
47
|
+
class_eval do
|
48
|
+
composed_of name.to_sym,
|
49
|
+
:class_name => "Money",
|
50
|
+
:mapping => [[subunit_name, "cents"], [model_currency_name, "currency_as_string"]],
|
51
|
+
:constructor => Proc.new { |cents, currency|
|
52
|
+
Money.new(cents || 0, field_currency_name || currency ||
|
53
|
+
Money.default_currency)
|
54
|
+
},
|
55
|
+
:converter => Proc.new { |value|
|
56
|
+
if value.respond_to?(:to_money)
|
57
|
+
if field_currency_name
|
58
|
+
value.to_money(field_currency_name)
|
59
|
+
else
|
60
|
+
value.to_money
|
61
|
+
end
|
62
|
+
else
|
63
|
+
raise(ArgumentError, "Can't convert #{value.class} to Money")
|
64
|
+
end
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Include numericality validation if needed
|
69
|
+
if MoneyRails.include_validations
|
70
|
+
class_eval do
|
71
|
+
validates_numericality_of subunit_name
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module MoneyRails
|
2
|
+
|
3
|
+
# MoneyRails configuration module.
|
4
|
+
# This is extended by MoneyRails to provide configuration settings.
|
5
|
+
module Configuration
|
6
|
+
|
7
|
+
# Start a MoneyRails configuration block in an initializer.
|
8
|
+
#
|
9
|
+
# example: Provide a default currency for the application
|
10
|
+
# MoneyRails.configure do |config|
|
11
|
+
# config.default_currency = :eur
|
12
|
+
# end
|
13
|
+
def configure
|
14
|
+
yield self
|
15
|
+
end
|
16
|
+
|
17
|
+
# Configuration parameters
|
18
|
+
|
19
|
+
# Set default currency of money library
|
20
|
+
def default_currency=(currency_name)
|
21
|
+
Money.default_currency = Money::Currency.new(currency_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Register a custom currency
|
25
|
+
def register_currency=(currency_options)
|
26
|
+
Money::Currency.register(currency_options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Use (by default) validation of numericality for each monetized field.
|
30
|
+
mattr_accessor :include_validations
|
31
|
+
@@include_validations = true
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "active_support/lazy_load_hooks"
|
2
|
+
|
3
|
+
# Thnx to Kristian Mandrup for the inspiration
|
4
|
+
# TODO: Include more ORMs/ODMs here
|
5
|
+
|
6
|
+
module MoneyRails
|
7
|
+
module Orms
|
8
|
+
def self.extend_for(name=:active_record)
|
9
|
+
case name.to_sym
|
10
|
+
when :active_record
|
11
|
+
if defined?(ActiveRecord::Base)
|
12
|
+
require "money-rails/active_record/monetizable"
|
13
|
+
|
14
|
+
# Lazy load extension
|
15
|
+
ActiveSupport.on_load :active_record do
|
16
|
+
include MoneyRails::ActiveRecord::Monetizable
|
17
|
+
end
|
18
|
+
end
|
19
|
+
else
|
20
|
+
raise ArgumentError, "ORM extension for #{name} is currently not supported."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Return all supported ORMs
|
25
|
+
def self.supported
|
26
|
+
%w{active_record}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/money-rails/railtie.rb
CHANGED
data/lib/money-rails/version.rb
CHANGED
data/money-rails.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.homepage = "https://github.com/RubyMoney/money"
|
14
14
|
|
15
15
|
s.files = Dir.glob("{lib,spec}/**/*")
|
16
|
-
s.files += %w(LICENSE README.md)
|
17
|
-
s.files += %w(money-rails.gemspec)
|
16
|
+
s.files += %w(CHANGELOG.md LICENSE README.md)
|
17
|
+
s.files += %w(Rakefile money-rails.gemspec)
|
18
18
|
|
19
19
|
s.test_files = s.files.grep(/^spec\//)
|
20
20
|
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "configuration" do
|
4
|
+
|
5
|
+
describe "initializer" do
|
6
|
+
|
7
|
+
it "sets default currency" do
|
8
|
+
Money.default_currency.should == Money::Currency.new(:eur)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "registers a custom currency" do
|
12
|
+
Money::Currency.table.should include(:eu4)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1 +1,27 @@
|
|
1
|
-
|
1
|
+
# encoding : utf-8
|
2
|
+
|
3
|
+
MoneyRails.configure do |config|
|
4
|
+
|
5
|
+
# To set the default currency
|
6
|
+
#
|
7
|
+
config.default_currency = :eur
|
8
|
+
|
9
|
+
# To handle the inclusion of validations for monetized fields
|
10
|
+
# The default value is true
|
11
|
+
#
|
12
|
+
config.include_validations = true
|
13
|
+
|
14
|
+
# Register a custom currency
|
15
|
+
#
|
16
|
+
config.register_currency = {
|
17
|
+
:priority => 1,
|
18
|
+
:iso_code => "EU4",
|
19
|
+
:name => "Euro with subunit of 4 digits",
|
20
|
+
:symbol => "€",
|
21
|
+
:symbol_first => true,
|
22
|
+
:subunit => "Subcent",
|
23
|
+
:subunit_to_unit => 10000,
|
24
|
+
:thousands_separator => ".",
|
25
|
+
:decimal_mark => ","
|
26
|
+
}
|
27
|
+
end
|
data/spec/dummy/log/test.log
CHANGED
@@ -167,3 +167,380 @@
|
|
167
167
|
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 21 Apr 2012 10:56:06 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 21 Apr 2012 10:56:06 UTC +00:00]]
|
168
168
|
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
169
169
|
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
170
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
171
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
172
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
173
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
174
|
+
[1m[36mSQL (25.5ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00]]
|
175
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
176
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
177
|
+
[1m[35m (0.0ms)[0m begin transaction
|
178
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
179
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00]]
|
180
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
181
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
182
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
183
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
184
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 15:26:59 UTC +00:00]]
|
185
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
186
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
187
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
188
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
189
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
190
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
191
|
+
[1m[36mSQL (4.2ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00]]
|
192
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
193
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
194
|
+
[1m[35m (0.0ms)[0m begin transaction
|
195
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
196
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00]]
|
197
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
198
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
199
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
200
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
201
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 17:52:22 UTC +00:00]]
|
202
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
203
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
204
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
205
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
206
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
207
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
208
|
+
[1m[36mSQL (4.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00]]
|
209
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
210
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
211
|
+
[1m[35m (0.1ms)[0m begin transaction
|
212
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
213
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00]]
|
214
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
215
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
216
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
217
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
218
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Sat, 28 Apr 2012 18:04:22 UTC +00:00]]
|
219
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
220
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
221
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
222
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
223
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
224
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
225
|
+
[1m[36mSQL (23.1ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00]]
|
226
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
227
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
228
|
+
[1m[35m (0.0ms)[0m begin transaction
|
229
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
230
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00]]
|
231
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
232
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
233
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
234
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
235
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00]]
|
236
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
237
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
238
|
+
[1m[35m (0.0ms)[0m begin transaction
|
239
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
240
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:14:47 UTC +00:00]]
|
241
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
242
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
243
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK TO SAVEPOINT active_record_1[0m
|
244
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
245
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
246
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
247
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
248
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
249
|
+
[1m[36mSQL (5.5ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00]]
|
250
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
251
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
252
|
+
[1m[35m (0.0ms)[0m begin transaction
|
253
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
254
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00]]
|
255
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
256
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
257
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
258
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
259
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00]]
|
260
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
261
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
262
|
+
[1m[35m (0.0ms)[0m begin transaction
|
263
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
264
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:15:34 UTC +00:00]]
|
265
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
266
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
267
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK TO SAVEPOINT active_record_1[0m
|
268
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
269
|
+
[1m[36m (0.3ms)[0m [1mUPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-04-30 23:15:34.779479' WHERE "products"."id" = 1[0m
|
270
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
271
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
272
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
273
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
274
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
275
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
276
|
+
[1m[36mSQL (4.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00]]
|
277
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
278
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
279
|
+
[1m[35m (0.0ms)[0m begin transaction
|
280
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
281
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00]]
|
282
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
283
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
284
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
285
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
286
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00]]
|
287
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
288
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
289
|
+
[1m[35m (0.0ms)[0m begin transaction
|
290
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
291
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00]]
|
292
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
293
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
294
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
295
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
296
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:23:36 UTC +00:00]]
|
297
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
298
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
299
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
300
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
301
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-04-30 23:23:36.931350' WHERE "products"."id" = 1
|
302
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
303
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
304
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
305
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
306
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
307
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
308
|
+
[1m[36mSQL (4.2ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
309
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
310
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
311
|
+
[1m[35m (0.1ms)[0m begin transaction
|
312
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
313
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
314
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
315
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
316
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
317
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
318
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
319
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
320
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
321
|
+
[1m[35m (0.1ms)[0m begin transaction
|
322
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
323
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
324
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
325
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
326
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
327
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
328
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
329
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
330
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
331
|
+
[1m[35m (0.1ms)[0m begin transaction
|
332
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
333
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:20 UTC +00:00]]
|
334
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
335
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
336
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK TO SAVEPOINT active_record_1[0m
|
337
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
338
|
+
[1m[36m (0.3ms)[0m [1mUPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-04-30 23:29:20.101664' WHERE "products"."id" = 1[0m
|
339
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
340
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
341
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
342
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
343
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
344
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
345
|
+
[1m[36mSQL (4.7ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
346
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
347
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
348
|
+
[1m[35m (0.1ms)[0m begin transaction
|
349
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
350
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
351
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
352
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
353
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
354
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
355
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
356
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
357
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
358
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 3210, "currency" = 'EUR', "updated_at" = '2012-04-30 23:29:35.897484' WHERE "products"."id" = 1
|
359
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
360
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
361
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
362
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
363
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
364
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
365
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
366
|
+
[1m[35m (0.1ms)[0m begin transaction
|
367
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
368
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
369
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
370
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
371
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
372
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
373
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:29:35 UTC +00:00]]
|
374
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
375
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
376
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
377
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
378
|
+
[1m[35m (0.2ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-04-30 23:29:35.943571' WHERE "products"."id" = 1
|
379
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
380
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
381
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
382
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
383
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
384
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
385
|
+
[1m[36mSQL (4.6ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
386
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
387
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
388
|
+
[1m[35m (0.1ms)[0m begin transaction
|
389
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
390
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
391
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
392
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
393
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
394
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
395
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
396
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
397
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
398
|
+
[1m[35m (0.2ms)[0m UPDATE "products" SET "price_cents" = 3210, "currency" = 'EUR', "updated_at" = '2012-04-30 23:38:21.163930' WHERE "products"."id" = 1
|
399
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
400
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
401
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
402
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
403
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
404
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
405
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
406
|
+
[1m[35m (0.1ms)[0m begin transaction
|
407
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
408
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
409
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
410
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
411
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
412
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
413
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Mon, 30 Apr 2012 23:38:21 UTC +00:00]]
|
414
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
415
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
416
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
417
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
418
|
+
[1m[35m (0.2ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-04-30 23:38:21.209437' WHERE "products"."id" = 1
|
419
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
420
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
421
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
422
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
423
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
424
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
425
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
426
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
427
|
+
[1m[36mSQL (19.7ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
428
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
429
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
430
|
+
[1m[35m (0.1ms)[0m begin transaction
|
431
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
432
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
433
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
434
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
435
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
436
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
437
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
438
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
439
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
440
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 3210, "currency" = 'EUR', "updated_at" = '2012-05-01 09:56:31.561775' WHERE "products"."id" = 1
|
441
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
442
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
443
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
444
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
445
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
446
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
447
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
448
|
+
[1m[35m (0.0ms)[0m begin transaction
|
449
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
450
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
451
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
452
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
453
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
454
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
455
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:56:31 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:56:31 UTC +00:00]]
|
456
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
457
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
458
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
459
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
460
|
+
[1m[35m (0.2ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-05-01 09:56:31.615413' WHERE "products"."id" = 1
|
461
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
462
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
463
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
464
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
465
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
466
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
467
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
468
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
469
|
+
[1m[36mSQL (4.5ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
470
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
471
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
472
|
+
[1m[35m (0.0ms)[0m begin transaction
|
473
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
474
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
475
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
476
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
477
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
478
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
479
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
480
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
481
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
482
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 3210, "currency" = 'EUR', "updated_at" = '2012-05-01 09:58:41.382431' WHERE "products"."id" = 1
|
483
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
484
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
485
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
486
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
487
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
488
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
489
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
490
|
+
[1m[35m (0.0ms)[0m begin transaction
|
491
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
492
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
493
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
494
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
495
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
496
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
497
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:58:41 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:58:41 UTC +00:00]]
|
498
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
499
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
500
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
501
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
502
|
+
[1m[35m (0.2ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-05-01 09:58:41.402104' WHERE "products"."id" = 1
|
503
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
504
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
505
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
506
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
507
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
508
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
509
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
510
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
511
|
+
[1m[36mSQL (4.5ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
512
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
513
|
+
[1m[36m (0.2ms)[0m [1mrollback transaction[0m
|
514
|
+
[1m[35m (0.0ms)[0m begin transaction
|
515
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
516
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
517
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
518
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
519
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
520
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
521
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
522
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
523
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
524
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 3210, "currency" = 'EUR', "updated_at" = '2012-05-01 09:59:49.232173' WHERE "products"."id" = 1
|
525
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
526
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
527
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
528
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
529
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
530
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
531
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
532
|
+
[1m[35m (0.1ms)[0m begin transaction
|
533
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
534
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
535
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
536
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
537
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
538
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
539
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "products" ("bonus_cents", "created_at", "currency", "discount", "price_cents", "updated_at") VALUES (?, ?, ?, ?, ?, ?)[0m [["bonus_cents", 200], ["created_at", Tue, 01 May 2012 09:59:49 UTC +00:00], ["currency", nil], ["discount", 150], ["price_cents", 3000], ["updated_at", Tue, 01 May 2012 09:59:49 UTC +00:00]]
|
540
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
541
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
542
|
+
[1m[35m (0.1ms)[0m ROLLBACK TO SAVEPOINT active_record_1
|
543
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
544
|
+
[1m[35m (0.3ms)[0m UPDATE "products" SET "price_cents" = 2000, "updated_at" = '2012-05-01 09:59:49.251905' WHERE "products"."id" = 1
|
545
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
546
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
data/spec/monetize_spec.rb
CHANGED
@@ -9,15 +9,33 @@ describe MoneyRails::Monetizable do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "attaches a Money object to model field" do
|
12
|
+
@product.price.should be_an_instance_of(Money)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "returns the expected money amount as a Money object" do
|
12
16
|
@product.price.should == Money.new(3000)
|
13
17
|
end
|
14
18
|
|
15
|
-
it "
|
19
|
+
it "assigns the correct value from a Money object" do
|
20
|
+
@product.price = Money.new(3210, "EUR")
|
21
|
+
@product.save.should be_true
|
22
|
+
@product.price_cents.should == 3210
|
23
|
+
end
|
24
|
+
|
25
|
+
it "respects :as argument" do
|
16
26
|
@product.discount_value.should == Money.new(150)
|
17
27
|
end
|
18
28
|
|
19
29
|
it "overrides table currency with a field specific" do
|
20
30
|
@product.bonus.currency.should == Money::Currency.find(:eur)
|
21
31
|
end
|
32
|
+
|
33
|
+
it "uses numericality validation" do
|
34
|
+
@product.price_cents = "foo"
|
35
|
+
@product.save.should be_false
|
36
|
+
|
37
|
+
@product.price_cents = 2000
|
38
|
+
@product.save.should be_true
|
39
|
+
end
|
22
40
|
end
|
23
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-05-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: money
|
@@ -134,9 +134,14 @@ extra_rdoc_files: []
|
|
134
134
|
files:
|
135
135
|
- lib/money-rails.rb
|
136
136
|
- lib/money-rails/railtie.rb
|
137
|
+
- lib/money-rails/active_record/monetizable.rb
|
137
138
|
- lib/money-rails/version.rb
|
138
|
-
- lib/money-rails/
|
139
|
+
- lib/money-rails/configuration.rb
|
140
|
+
- lib/money-rails/orms.rb
|
141
|
+
- lib/generators/money_rails/initializer_generator.rb
|
142
|
+
- lib/generators/templates/money.rb
|
139
143
|
- spec/spec_helper.rb
|
144
|
+
- spec/config_spec.rb
|
140
145
|
- spec/dummy/script/rails
|
141
146
|
- spec/dummy/Rakefile
|
142
147
|
- spec/dummy/db/schema.rb
|
@@ -176,8 +181,10 @@ files:
|
|
176
181
|
- spec/dummy/public/favicon.ico
|
177
182
|
- spec/dummy/public/500.html
|
178
183
|
- spec/monetize_spec.rb
|
184
|
+
- CHANGELOG.md
|
179
185
|
- LICENSE
|
180
186
|
- README.md
|
187
|
+
- Rakefile
|
181
188
|
- money-rails.gemspec
|
182
189
|
homepage: https://github.com/RubyMoney/money
|
183
190
|
licenses:
|
@@ -206,6 +213,7 @@ specification_version: 3
|
|
206
213
|
summary: Money gem integration with Rails
|
207
214
|
test_files:
|
208
215
|
- spec/spec_helper.rb
|
216
|
+
- spec/config_spec.rb
|
209
217
|
- spec/dummy/script/rails
|
210
218
|
- spec/dummy/Rakefile
|
211
219
|
- spec/dummy/db/schema.rb
|
data/lib/money-rails/monetize.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'active_support/concern'
|
2
|
-
require 'active_support/core_ext/array/extract_options'
|
3
|
-
require 'active_support/deprecation/reporting'
|
4
|
-
|
5
|
-
module MoneyRails
|
6
|
-
module Monetizable
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
def monetize(field, *args)
|
11
|
-
options = args.extract_options!
|
12
|
-
|
13
|
-
# Stringify model field name
|
14
|
-
subunit_name = field.to_s
|
15
|
-
|
16
|
-
if options[:field_currency] || options[:target_name] ||
|
17
|
-
options[:model_currency]
|
18
|
-
ActiveSupport::Deprecation.warn("You are using the old " \
|
19
|
-
"argument keys of monetize command! Instead use :as, " \
|
20
|
-
":with_currency or :with_model_currency")
|
21
|
-
end
|
22
|
-
|
23
|
-
# Model currency field name
|
24
|
-
model_currency_name = options[:with_model_currency] ||
|
25
|
-
options[:model_currency] || "currency"
|
26
|
-
|
27
|
-
# Override Model and default currency
|
28
|
-
field_currency_name = options[:with_currency] ||
|
29
|
-
options[:field_currency] || nil
|
30
|
-
|
31
|
-
name = options[:as] || options[:target_name] || nil
|
32
|
-
|
33
|
-
# Form target name for the money backed ActiveModel field:
|
34
|
-
# if a target name is provided then use it
|
35
|
-
# if there is a "_cents" suffix then just remove it to create the target name
|
36
|
-
# if none of the previous is the case then use a default suffix
|
37
|
-
if name
|
38
|
-
name = name.to_s
|
39
|
-
elsif subunit_name =~ /_cents$/
|
40
|
-
name = subunit_name.sub(/_cents$/, "")
|
41
|
-
else
|
42
|
-
# FIXME: provide a better default
|
43
|
-
name = subunit_name << "_money"
|
44
|
-
end
|
45
|
-
|
46
|
-
class_eval do
|
47
|
-
composed_of name.to_sym,
|
48
|
-
:class_name => "Money",
|
49
|
-
:mapping => [[subunit_name, "cents"], [model_currency_name, "currency_as_string"]],
|
50
|
-
:constructor => Proc.new { |cents, currency|
|
51
|
-
Money.new(cents || 0, field_currency_name || currency ||
|
52
|
-
Money.default_currency)
|
53
|
-
},
|
54
|
-
:converter => Proc.new { |value|
|
55
|
-
if value.respond_to?(:to_money)
|
56
|
-
if field_currency_name
|
57
|
-
value.to_money(field_currency_name)
|
58
|
-
else
|
59
|
-
value.to_money
|
60
|
-
end
|
61
|
-
else
|
62
|
-
raise(ArgumentError, "Can't convert #{value.class} to Money")
|
63
|
-
end
|
64
|
-
}
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|