acts_as_singleton 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module ActiveRecord
17
17
  # clash with the <tt>ActiveRecord::Singleton::PRIVATE</tt> pattern, or
18
18
  # define them after including the module.
19
19
  module Singleton
20
- VERSION = "0.0.2"
20
+ VERSION = "0.0.5"
21
21
 
22
22
  # This pattern matches methods that should be made private because they
23
23
  # should not be used in singleton classes.
@@ -54,6 +54,14 @@ module ActiveRecord
54
54
  end
55
55
  super # (:first) || create
56
56
  end
57
+
58
+ def find_by_sql(sql)
59
+ unless caller.first.include?("lib/active_record")
60
+ raise NoMethodError,
61
+ "private method `find_by_sql' called for #{inspect}"
62
+ end
63
+ super # (:first) || create
64
+ end
57
65
  end
58
66
 
59
67
  def clone
@@ -61,6 +61,7 @@ class ActsAsSingletonTest < ActiveSupport::TestCase
61
61
  assert_raise(NoMethodError) { HomepageSettings.all }
62
62
  assert_raise(NoMethodError) { HomepageSettings.first }
63
63
  assert_raise(NoMethodError) { HomepageSettings.find }
64
+ assert_raise(NoMethodError) { HomepageSettings.find_by_sql("") }
64
65
  assert_raise(NoMethodError) { HomepageSettings.named_scope }
65
66
  assert_raise(NoMethodError) { HomepageSettings.minimum }
66
67
  assert_raise(NoMethodError) { HomepageSettings.maximum }
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_singleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 5
9
+ version: 0.0.5
5
10
  platform: ruby
6
11
  authors:
7
12
  - Stephen Celis
@@ -9,19 +14,22 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-01-21 00:00:00 -06:00
17
+ date: 2010-07-28 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: activerecord
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
23
30
  version: "0"
24
- version:
31
+ type: :runtime
32
+ version_requirements: *id001
25
33
  description: "It just makes sense to store mutable, site-wide, admin-level settings in the database. Right? A key-value table may be more flexible, but maybe we don't want to be flexible! If you truly want that flexibility: http://github.com/stephencelis/kvc"
26
34
  email: stephen@stephencelis.com
27
35
  executables: []
@@ -51,21 +59,25 @@ rdoc_options:
51
59
  require_paths:
52
60
  - lib
53
61
  required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
54
63
  requirements:
55
64
  - - ">="
56
65
  - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
57
68
  version: "0"
58
- version:
59
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
60
71
  requirements:
61
72
  - - ">="
62
73
  - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
63
76
  version: "0"
64
- version:
65
77
  requirements: []
66
78
 
67
79
  rubyforge_project:
68
- rubygems_version: 1.3.5
80
+ rubygems_version: 1.3.7
69
81
  signing_key:
70
82
  specification_version: 3
71
83
  summary: A lightweight singleton library for your Active Record models.