easy_rails_money 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -30,3 +30,12 @@
30
30
  an error and we will assume that a single
31
31
  currency is defined. So always restart the app after the
32
32
  migrations are run.
33
+
34
+ ## 0.0.6
35
+ - bugfix: on a bugfix at v0.0.5
36
+ database adapter is leaking through. leaky abstaction
37
+ the error handling for
38
+ EasyRailsMoney::ActiveRecord::MoneyDsl.single_currency?
39
+ is dependent on the database adapter being used, which sucks.
40
+ can test on other database adapters or handle a generic error
41
+
data/README.md CHANGED
@@ -368,3 +368,7 @@ loan_usd.currency # equals Money::Currency.new(:usd)
368
368
  currency is defined. So always restart the app after the
369
369
  migrations are run.
370
370
  Any better way ?
371
+ Also the error handling EasyRailsMoney::ActiveRecord::MoneyDsl.single_currency?
372
+ is dependent on the database adapter
373
+ being used, which sucks. can test on other database adapters
374
+ or handle a generic error
@@ -15,8 +15,12 @@ module EasyRailsMoney
15
15
  # and we will assume that a single currency is defined
16
16
  # So always restart the app after the migrations are run
17
17
  self.columns_hash.has_key? "currency"
18
- rescue ::ActiveRecord::StatementInvalid => err
19
- if err.message =~ /Could not find table/
18
+ rescue Object => err
19
+ # leaky abstaction. database adapter is leaking through
20
+ # postgres with activerecord throws an error of type PG::Error and sqlite of ActiveRecord::StatementInvalid
21
+ # so we depend on the message, not the class. still need to test on other
22
+ # database adapters because the message is not exactly the same
23
+ if err.message =~ /Could not find table/ || err.message =~ /relation (.+) does not exist/
20
24
  return true
21
25
  else
22
26
  raise
@@ -1,3 +1,3 @@
1
1
  module EasyRailsMoney
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_rails_money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -242,7 +242,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
242
  version: '0'
243
243
  segments:
244
244
  - 0
245
- hash: 539753263843198908
245
+ hash: -3096620913811458787
246
246
  required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  none: false
248
248
  requirements:
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  version: '0'
252
252
  segments:
253
253
  - 0
254
- hash: 539753263843198908
254
+ hash: -3096620913811458787
255
255
  requirements: []
256
256
  rubyforge_project:
257
257
  rubygems_version: 1.8.24