active_modularity 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e14b31ee831e9a582ac868ad6f6197fc3c0d6bff
4
- data.tar.gz: 80c01c7311c87a7f95faa9ac8ec1ff22477b4704
3
+ metadata.gz: bae82e2848462c9be125c535929cf717a4a03cf9
4
+ data.tar.gz: a6010503fb832b04e30d4121329b494b204260d9
5
5
  SHA512:
6
- metadata.gz: 204b5c3de34bc895263d142cf750fbc0769eb032e0a3aa8232acdaf09c7f23f6ba7ff00bd64497bad8768cabdfc278cb0c3c9f345900857066f8b587e6de2163
7
- data.tar.gz: 0182d3828ee3b8a1ebf14e8c1af1fcc873e16085ca81d21b575fca83b36de9c696c016162a8e041b60271140298e9a1af9f9faee543d842155b2c1743e1919d3
6
+ metadata.gz: f626715952a550ec7e1b5db4fde0ce3440d553c16150064a124d6bba641857dfa3364a5251e671b9c320e6cb355466e4d4a947983503436902327fbe9064acc6
7
+ data.tar.gz: 8efb5d7ea828a25b0d5e2b9efd864c6a92ee8d9181729d7fe0d52a99091eca715f9d736a97b041a40008e027ef08192f5ff67fd67c98c9ea1e34e5beb6731630
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ env:
6
+ - DB=sqlite
7
+ script: rspec spec
data/README.md CHANGED
@@ -20,9 +20,13 @@ Or install it yourself as:
20
20
  ## Examples ##
21
21
 
22
22
  # config/initializers/acts_as_modurarity.rb
23
+
23
24
  # enable active modurality
24
25
  ActiveRecord::Base.acts_as_modurality
25
26
 
27
+ # load all files (Must be loaded the models and controllers.)
28
+ YourApp::Application.eager_load! unless Rails.configuration.cache_classes
29
+
26
30
  #
27
31
  # has many association
28
32
  #
@@ -51,11 +55,11 @@ Or install it yourself as:
51
55
 
52
56
  # standard association
53
57
  person = Person.create
54
- person.entries.build.class.name # Person
58
+ person.entries.build.class.name # Entry
55
59
 
56
60
  # inner module association
57
61
  admin_person = Admin::Person.create
58
- admin_person.entries.build.class.name # Admin::Person
62
+ admin_person.entries.build.class.name # Admin::Entry
59
63
 
60
64
 
61
65
  #
@@ -94,16 +98,14 @@ Or install it yourself as:
94
98
  # app/models/admin/customer.rb
95
99
  module Admin
96
100
  class Customer < ::Customer
97
- # include Admin::Person common code
98
- include Person::Common
101
+ include Admin::Person::Common
99
102
  end
100
103
  end
101
104
 
102
105
  # app/models/admin/employee.rb
103
106
  module Admin
104
107
  class Employee < ::Employee
105
- # include Admin::Person common code
106
- include Person::Common
108
+ include Admin::Person::Common
107
109
  end
108
110
  end
109
111
 
@@ -123,6 +125,9 @@ Or install it yourself as:
123
125
  Admin::Person.find(alice.id).class.name # Admin::Customer
124
126
  Admin::Person.find(bob.id ).class.name # Admin::Customer
125
127
 
128
+ ## Introductory articles
129
+
130
+ * [techscore blog (in Japanese)](http://www.techscore.com/blog/2013/05/09/active_modularity/ "techscore")
126
131
 
127
132
  ## Contributing
128
133
 
@@ -33,16 +33,19 @@ module ActiveModularity
33
33
 
34
34
  # fix inner module sti base class
35
35
  def force_sti_base!
36
- if ActiveRecord::Base != superclass &&
36
+ @@force_sti_base = true
37
+ end
38
+
39
+ def descends_from_active_record?
40
+ if @@force_sti_base &&
41
+ ActiveRecord::Base != superclass &&
37
42
  !self.abstract_class? &&
38
43
  superclass.descends_from_active_record? &&
39
44
  superclass.name == name.demodulize &&
40
45
  columns_hash.include?(inheritance_column)
41
- singleton_class.send(:define_method, :descends_from_active_record?) { true }
42
- true
43
- else
44
- false
46
+ return true
45
47
  end
48
+ super
46
49
  end
47
50
 
48
51
  # fix inner module reflections
@@ -1,3 +1,3 @@
1
1
  module ActiveModularity
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_modularity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yuki teraoka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-02 00:00:00.000000000 Z
11
+ date: 2013-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,6 +130,7 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - .gitignore
133
+ - .travis.yml
133
134
  - Gemfile
134
135
  - LICENSE.txt
135
136
  - README.md
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  version: '0'
163
164
  requirements: []
164
165
  rubyforge_project:
165
- rubygems_version: 2.0.3
166
+ rubygems_version: 2.0.0
166
167
  signing_key:
167
168
  specification_version: 4
168
169
  summary: ActiveRecord model inheritance support by module. Fix inner module association