Skip to content
This repository
Browse code

fix bug issue #1

  • Loading branch information...
commit 44f884d42267965e226ab6f4859a28b2113a6e1e 1 parent c3f889d
Jie Fan authored March 06, 2012
3  .idea/misc.xml
... ...
@@ -1,8 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3  
-  <component name="DependencyValidationManager">
4  
-    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
5  
-  </component>
6 3
   <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.2-p136" project-jdk-type="RUBY_SDK" />
7 4
 </project>
8 5
 
12  .idea/mongo_followable.iml
@@ -4,7 +4,17 @@
4 4
     <content url="file://$MODULE_DIR$" />
5 5
     <orderEntry type="inheritedJdk" />
6 6
     <orderEntry type="sourceFolder" forTests="false" />
7  
-    <orderEntry type="library" scope="PROVIDED" name="[gem] bundler (v1.0.21, /home/tomato/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.21)" level="application" />
  7
+    <orderEntry type="library" scope="PROVIDED" name="bson (v1.5.2, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  8
+    <orderEntry type="library" scope="PROVIDED" name="bson_ext (v1.5.2, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  9
+    <orderEntry type="library" scope="PROVIDED" name="builder (v3.0.0, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  10
+    <orderEntry type="library" scope="PROVIDED" name="bundler (v1.0.22, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  11
+    <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.3, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  12
+    <orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.0, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  13
+    <orderEntry type="library" scope="PROVIDED" name="mongo (v1.5.2, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  14
+    <orderEntry type="library" scope="PROVIDED" name="mongoid (v2.4.6, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  15
+    <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.0.4, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  16
+    <orderEntry type="library" scope="PROVIDED" name="rspec (v2.7.0, RVM: ruby-1.9.2-p136) [gem]" level="application" />
  17
+    <orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.31, RVM: ruby-1.9.2-p136) [gem]" level="application" />
8 18
   </component>
9 19
 </module>
10 20
 
5  .idea/scopes/scope_settings.xml
... ...
@@ -0,0 +1,5 @@
  1
+<component name="DependencyValidationManager">
  2
+  <state>
  3
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
  4
+  </state>
  5
+</component>
260  .idea/workspace.xml
@@ -2,12 +2,20 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="46dc3a6d-3a97-49f8-becd-2ccba8c07e42" name="Default" comment="">
  5
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/mongo_followable/string_ext.rb" />
  6
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/mongo_mapper/childuser.rb" />
  7
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/spec/mongoid/childuser.rb" />
  8
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/mongo_followable.iml" afterPath="$PROJECT_DIR$/.idea/mongo_followable.iml" />
  9
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
5 10
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
6 11
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.rdoc" afterPath="$PROJECT_DIR$/README.rdoc" />
  12
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/follow.rb" afterPath="$PROJECT_DIR$/app/models/follow.rb" />
  13
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/mongo_followable.rb" afterPath="$PROJECT_DIR$/lib/mongo_followable.rb" />
7 14
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/mongo_followable/followable.rb" afterPath="$PROJECT_DIR$/lib/mongo_followable/followable.rb" />
8 15
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/mongo_followable/follower.rb" afterPath="$PROJECT_DIR$/lib/mongo_followable/follower.rb" />
9 16
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/mongo_followable/version.rb" afterPath="$PROJECT_DIR$/lib/mongo_followable/version.rb" />
10 17
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/mongo/followable_spec.rb" afterPath="$PROJECT_DIR$/spec/mongo/followable_spec.rb" />
  18
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/spec/spec_helper.rb" afterPath="$PROJECT_DIR$/spec/spec_helper.rb" />
11 19
     </list>
12 20
     <ignored path="mongo_followable.iws" />
13 21
     <ignored path=".idea/workspace.xml" />
@@ -18,10 +26,8 @@
18 26
     <option name="LAST_RESOLUTION" value="IGNORE" />
19 27
   </component>
20 28
   <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
21  
-  <component name="CoverageDataManager" choice="3" />
22 29
   <component name="CreatePatchCommitExecutor">
23 30
     <option name="PATCH_PATH" value="" />
24  
-    <option name="REVERSE_PATCH" value="false" />
25 31
   </component>
26 32
   <component name="DaemonCodeAnalyzer">
27 33
     <disable_hints />
@@ -30,44 +36,7 @@
30 36
     <favorites_list name="mongo_followable" />
31 37
   </component>
32 38
   <component name="FileEditorManager">
33  
-    <leaf>
34  
-      <file leaf-file-name="followable.rb" pinned="false" current="false" current-in-tab="false">
35  
-        <entry file="file://$PROJECT_DIR$/lib/mongo_followable/followable.rb">
36  
-          <provider selected="true" editor-type-id="text-editor">
37  
-            <state line="127" column="36" selection-start="3865" selection-end="3865" vertical-scroll-proportion="0.0">
38  
-              <folding />
39  
-            </state>
40  
-          </provider>
41  
-        </entry>
42  
-      </file>
43  
-      <file leaf-file-name="README.rdoc" pinned="false" current="false" current-in-tab="false">
44  
-        <entry file="file://$PROJECT_DIR$/README.rdoc">
45  
-          <provider selected="true" editor-type-id="text-editor">
46  
-            <state line="53" column="83" selection-start="1649" selection-end="1649" vertical-scroll-proportion="0.0">
47  
-              <folding />
48  
-            </state>
49  
-          </provider>
50  
-        </entry>
51  
-      </file>
52  
-      <file leaf-file-name="follower.rb" pinned="false" current="false" current-in-tab="false">
53  
-        <entry file="file://$PROJECT_DIR$/lib/mongo_followable/follower.rb">
54  
-          <provider selected="true" editor-type-id="text-editor">
55  
-            <state line="160" column="34" selection-start="4901" selection-end="4901" vertical-scroll-proportion="0.0">
56  
-              <folding />
57  
-            </state>
58  
-          </provider>
59  
-        </entry>
60  
-      </file>
61  
-      <file leaf-file-name="followable_spec.rb" pinned="false" current="true" current-in-tab="true">
62  
-        <entry file="file://$PROJECT_DIR$/spec/mongo/followable_spec.rb">
63  
-          <provider selected="true" editor-type-id="text-editor">
64  
-            <state line="216" column="9" selection-start="4887" selection-end="4887" vertical-scroll-proportion="0.7826087">
65  
-              <folding />
66  
-            </state>
67  
-          </provider>
68  
-        </entry>
69  
-      </file>
70  
-    </leaf>
  39
+    <leaf />
71 40
   </component>
72 41
   <component name="FindManager">
73 42
     <FindUsagesManager>
@@ -75,28 +44,36 @@
75 44
     </FindUsagesManager>
76 45
   </component>
77 46
   <component name="Git.Settings">
78  
-    <option name="CHECKOUT_INCLUDE_TAGS" value="false" />
79  
-    <option name="UPDATE_CHANGES_POLICY" value="STASH" />
  47
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
80 48
   </component>
81 49
   <component name="IdeDocumentHistory">
82 50
     <option name="changedFiles">
83 51
       <list>
84  
-        <option value="$PROJECT_DIR$/app/models/follow.rb" />
85 52
         <option value="$PROJECT_DIR$/spec/mongo_mapper/group.rb" />
86 53
         <option value="$PROJECT_DIR$/spec/mongo_mapper/user.rb" />
87 54
         <option value="$PROJECT_DIR$/spec/mongoid/group.rb" />
88 55
         <option value="$PROJECT_DIR$/spec/mongoid/user.rb" />
89 56
         <option value="$PROJECT_DIR$/lib/mongo_followable.rb" />
90  
-        <option value="$PROJECT_DIR$/mongo_followable.gemspec" />
91  
-        <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
92  
-        <option value="$PROJECT_DIR$/lib/mongo_followable/version.rb" />
  57
+        <option value="$PROJECT_DIR$/app/models/follow.rb" />
93 58
         <option value="$PROJECT_DIR$/lib/mongo_followable/follower.rb" />
94 59
         <option value="$PROJECT_DIR$/lib/mongo_followable/followable.rb" />
  60
+        <option value="$PROJECT_DIR$/lib/mongo_followable/version.rb" />
  61
+        <option value="$PROJECT_DIR$/mongo_followable.gemspec" />
95 62
         <option value="$PROJECT_DIR$/README.rdoc" />
  63
+        <option value="$PROJECT_DIR$/lib/mongo_followable/string_ext.rb" />
  64
+        <option value="$PROJECT_DIR$/spec/mongoid/childuser.rb" />
  65
+        <option value="$PROJECT_DIR$/spec/mongo_mapper/childuser.rb" />
  66
+        <option value="$PROJECT_DIR$/spec/spec_helper.rb" />
96 67
         <option value="$PROJECT_DIR$/spec/mongo/followable_spec.rb" />
97 68
       </list>
98 69
     </option>
99 70
   </component>
  71
+  <component name="ProjectFrameBounds">
  72
+    <option name="x" value="1" />
  73
+    <option name="y" value="24" />
  74
+    <option name="width" value="1599" />
  75
+    <option name="height" value="851" />
  76
+  </component>
100 77
   <component name="ProjectLevelVcsManager" settingsEditedManually="false">
101 78
     <OptionsSetting value="true" id="Add" />
102 79
     <OptionsSetting value="true" id="Remove" />
@@ -123,7 +100,6 @@
123 100
       <sortByType />
124 101
     </navigator>
125 102
     <panes>
126  
-      <pane id="Favorites" />
127 103
       <pane id="ProjectPane">
128 104
         <subPane>
129 105
           <PATH>
@@ -242,17 +218,70 @@
242 218
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
243 219
             </PATH_ELEMENT>
244 220
           </PATH>
  221
+          <PATH>
  222
+            <PATH_ELEMENT>
  223
+              <option name="myItemId" value="mongo_followable" />
  224
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
  225
+            </PATH_ELEMENT>
  226
+            <PATH_ELEMENT>
  227
+              <option name="myItemId" value="mongo_followable" />
  228
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  229
+            </PATH_ELEMENT>
  230
+            <PATH_ELEMENT>
  231
+              <option name="myItemId" value="app" />
  232
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  233
+            </PATH_ELEMENT>
  234
+            <PATH_ELEMENT>
  235
+              <option name="myItemId" value="models" />
  236
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  237
+            </PATH_ELEMENT>
  238
+          </PATH>
245 239
         </subPane>
246 240
       </pane>
247 241
       <pane id="Scope" />
  242
+      <pane id="Favorites" />
248 243
     </panes>
249 244
   </component>
  245
+  <component name="PropertiesComponent">
  246
+    <property name="WebServerToolWindowFactoryState" value="false" />
  247
+  </component>
250 248
   <component name="RecentsManager">
251 249
     <key name="CopyFile.RECENT_KEYS">
  250
+      <recent name="$PROJECT_DIR$/spec/mongo_mapper" />
252 251
       <recent name="$PROJECT_DIR$" />
253 252
     </key>
254 253
   </component>
255 254
   <component name="RunManager">
  255
+    <configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
  256
+      <predefined_log_file id="RUBY_RSPEC" enabled="true" />
  257
+      <module name="" />
  258
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
  259
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
  260
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
  261
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
  262
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
  263
+      <envs />
  264
+      <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
  265
+      <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
  266
+        <COVERAGE_PATTERN ENABLED="true">
  267
+          <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
  268
+        </COVERAGE_PATTERN>
  269
+      </EXTENSION>
  270
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
  271
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
  272
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
  273
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
  274
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
  275
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
  276
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
  277
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
  278
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
  279
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
  280
+      <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
  281
+      <method>
  282
+        <option name="RakeTask" enabled="false" />
  283
+      </method>
  284
+    </configuration>
256 285
     <configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
257 286
       <module name="" />
258 287
       <RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -269,7 +298,35 @@
269 298
       </EXTENSION>
270 299
       <RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
271 300
       <RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
272  
-      <method />
  301
+      <method>
  302
+        <option name="RakeTask" enabled="false" />
  303
+      </method>
  304
+    </configuration>
  305
+    <configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
  306
+      <predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
  307
+      <module name="" />
  308
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
  309
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
  310
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
  311
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
  312
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
  313
+      <envs />
  314
+      <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
  315
+      <EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
  316
+        <COVERAGE_PATTERN ENABLED="true">
  317
+          <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
  318
+        </COVERAGE_PATTERN>
  319
+      </EXTENSION>
  320
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
  321
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
  322
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
  323
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
  324
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
  325
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
  326
+      <RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
  327
+      <method>
  328
+        <option name="RakeTask" enabled="false" />
  329
+      </method>
273 330
     </configuration>
274 331
     <list size="0" />
275 332
   </component>
@@ -299,14 +356,16 @@
299 356
   </component>
300 357
   <component name="ToolWindowManager">
301 358
     <frame x="1" y="24" width="1599" height="851" extended-state="0" />
302  
-    <editor active="true" />
  359
+    <editor active="false" />
303 360
     <layout>
  361
+      <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
304 362
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
305 363
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
306 364
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
307  
-      <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
308  
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.19796307" sideWeight="0.6703601" order="0" side_tool="false" content_ui="tabs" />
  365
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20103426" sideWeight="0.6703601" order="0" side_tool="false" content_ui="combo" />
309 366
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
  367
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
  368
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
310 369
       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
311 370
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
312 371
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@@ -314,13 +373,26 @@
314 373
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
315 374
       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32963988" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
316 375
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
  376
+      <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
317 377
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
318 378
       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
319 379
     </layout>
320 380
   </component>
  381
+  <component name="VcsContentAnnotationSettings">
  382
+    <option name="myLimit" value="2678400000" />
  383
+  </component>
321 384
   <component name="VcsManagerConfiguration">
322 385
     <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
323 386
     <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
  387
+    <option name="CHECK_NEW_TODO" value="true" />
  388
+    <option name="myTodoPanelSettings">
  389
+      <value>
  390
+        <are-packages-shown value="false" />
  391
+        <are-modules-shown value="false" />
  392
+        <flatten-packages value="false" />
  393
+        <is-autoscroll-to-source value="false" />
  394
+      </value>
  395
+    </option>
324 396
     <option name="PERFORM_UPDATE_IN_BACKGROUND" value="true" />
325 397
     <option name="PERFORM_COMMIT_IN_BACKGROUND" value="true" />
326 398
     <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
@@ -332,6 +404,14 @@
332 404
     <option name="CHANGED_ON_SERVER_INTERVAL" value="60" />
333 405
     <option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
334 406
     <option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
  407
+    <option name="DEFAULT_PATCH_EXTENSION" value="patch" />
  408
+    <option name="SHORT_DIFF_HORISONTALLY" value="true" />
  409
+    <option name="SHORT_DIFF_EXTRA_LINES" value="2" />
  410
+    <option name="SOFT_WRAPS_IN_SHORT_DIFF" value="true" />
  411
+    <option name="INCLUDE_TEXT_INTO_PATCH" value="false" />
  412
+    <option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
  413
+    <option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
  414
+    <option name="SHOW_FILE_HISTORY_DETAILS" value="true" />
335 415
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
336 416
     <option name="LAST_COMMIT_MESSAGE" />
337 417
     <option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
@@ -351,92 +431,110 @@
351 431
     <breakpoint-manager />
352 432
   </component>
353 433
   <component name="editorHistoryManager">
354  
-    <entry file="file://$PROJECT_DIR$/LICENSE.txt">
  434
+    <entry file="file://$PROJECT_DIR$/spec/mongo_mapper/group.rb">
355 435
       <provider selected="true" editor-type-id="text-editor">
356  
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  436
+        <state line="2" column="15" selection-start="59" selection-end="59" vertical-scroll-proportion="0.04347826" />
357 437
       </provider>
358 438
     </entry>
359  
-    <entry file="file://$PROJECT_DIR$/Rakefile">
  439
+    <entry file="file://$PROJECT_DIR$/Gemfile">
360 440
       <provider selected="true" editor-type-id="text-editor">
361 441
         <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
362 442
       </provider>
363 443
     </entry>
364  
-    <entry file="file://$PROJECT_DIR$/spec/mongo_mapper/user.rb">
  444
+    <entry file="file://$PROJECT_DIR$/lib/mongo_followable.rb">
365 445
       <provider selected="true" editor-type-id="text-editor">
366  
-        <state line="3" column="15" selection-start="86" selection-end="86" vertical-scroll-proportion="0.06521739" />
  446
+        <state line="5" column="70" selection-start="180" selection-end="180" vertical-scroll-proportion="0.10885341">
  447
+          <folding />
  448
+        </state>
367 449
       </provider>
368 450
     </entry>
369  
-    <entry file="file://$PROJECT_DIR$/spec/mongoid/user.rb">
  451
+    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/version.rb">
370 452
       <provider selected="true" editor-type-id="text-editor">
371  
-        <state line="2" column="15" selection-start="54" selection-end="54" vertical-scroll-proportion="0.04347826" />
  453
+        <state line="1" column="18" selection-start="41" selection-end="41" vertical-scroll-proportion="0.021770682">
  454
+          <folding />
  455
+        </state>
372 456
       </provider>
373 457
     </entry>
374  
-    <entry file="file://$PROJECT_DIR$/spec/mongoid/group.rb">
  458
+    <entry file="file://$PROJECT_DIR$/mongo_followable.gemspec">
375 459
       <provider selected="true" editor-type-id="text-editor">
376  
-        <state line="1" column="16" selection-start="28" selection-end="28" vertical-scroll-proportion="0.02173913" />
  460
+        <state line="15" column="42" selection-start="606" selection-end="606" vertical-scroll-proportion="0.32656023">
  461
+          <folding />
  462
+        </state>
377 463
       </provider>
378 464
     </entry>
379  
-    <entry file="file://$PROJECT_DIR$/spec/mongo_mapper/group.rb">
  465
+    <entry file="file://$PROJECT_DIR$/spec/mongoid/user.rb">
380 466
       <provider selected="true" editor-type-id="text-editor">
381  
-        <state line="2" column="15" selection-start="59" selection-end="59" vertical-scroll-proportion="0.04347826" />
  467
+        <state line="2" column="15" selection-start="0" selection-end="96" vertical-scroll-proportion="0.043541364">
  468
+          <folding />
  469
+        </state>
382 470
       </provider>
383 471
     </entry>
384  
-    <entry file="file://$PROJECT_DIR$/Gemfile">
  472
+    <entry file="file://$PROJECT_DIR$/spec/mongo_mapper/user.rb">
385 473
       <provider selected="true" editor-type-id="text-editor">
386  
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  474
+        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
  475
+          <folding />
  476
+        </state>
387 477
       </provider>
388 478
     </entry>
389  
-    <entry file="file://$PROJECT_DIR$/app/models/follow.rb">
  479
+    <entry file="file://$PROJECT_DIR$/spec/mongo_mapper/childuser.rb">
390 480
       <provider selected="true" editor-type-id="text-editor">
391  
-        <state line="10" column="30" selection-start="263" selection-end="263" vertical-scroll-proportion="0.2173913" />
  481
+        <state line="1" column="21" selection-start="37" selection-end="37" vertical-scroll-proportion="0.021770682">
  482
+          <folding />
  483
+        </state>
392 484
       </provider>
393 485
     </entry>
394  
-    <entry file="file://$PROJECT_DIR$/lib/mongo_followable.rb">
  486
+    <entry file="file://$PROJECT_DIR$/spec/mongo/followable_spec.rb">
395 487
       <provider selected="true" editor-type-id="text-editor">
396  
-        <state line="6" column="48" selection-start="301" selection-end="301" vertical-scroll-proportion="0.13043478" />
  488
+        <state line="245" column="20" selection-start="5399" selection-end="5399" vertical-scroll-proportion="0.9564586">
  489
+          <folding />
  490
+        </state>
397 491
       </provider>
398 492
     </entry>
399 493
     <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
400 494
       <provider selected="true" editor-type-id="text-editor">
401  
-        <state line="24" column="42" selection-start="786" selection-end="786" vertical-scroll-proportion="0.5217391" />
  495
+        <state line="25" column="53" selection-start="858" selection-end="858" vertical-scroll-proportion="0.54426706">
  496
+          <folding />
  497
+        </state>
402 498
       </provider>
403 499
     </entry>
404  
-    <entry file="file://$PROJECT_DIR$/mongo_followable.gemspec">
  500
+    <entry file="file://$PROJECT_DIR$/spec/mongoid/childuser.rb">
405 501
       <provider selected="true" editor-type-id="text-editor">
406  
-        <state line="10" column="48" selection-start="408" selection-end="408" vertical-scroll-proportion="0.2173913" />
  502
+        <state line="0" column="11" selection-start="11" selection-end="11" vertical-scroll-proportion="0.0">
  503
+          <folding />
  504
+        </state>
407 505
       </provider>
408 506
     </entry>
409  
-    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/version.rb">
  507
+    <entry file="file://$PROJECT_DIR$/app/models/follow.rb">
410 508
       <provider selected="true" editor-type-id="text-editor">
411  
-        <state line="1" column="18" selection-start="41" selection-end="41" vertical-scroll-proportion="0.02173913">
  509
+        <state line="16" column="71" selection-start="436" selection-end="436" vertical-scroll-proportion="0.34833091">
412 510
           <folding />
413 511
         </state>
414 512
       </provider>
415 513
     </entry>
416  
-    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/follower.rb">
  514
+    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/string_ext.rb">
417 515
       <provider selected="true" editor-type-id="text-editor">
418  
-        <state line="160" column="34" selection-start="4901" selection-end="4901" vertical-scroll-proportion="0.0">
  516
+        <state line="1" column="29" selection-start="42" selection-end="42" vertical-scroll-proportion="0.021770682">
419 517
           <folding />
420 518
         </state>
421 519
       </provider>
422 520
     </entry>
423  
-    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/followable.rb">
  521
+    <entry file="file://$PROJECT_DIR$/README.rdoc">
424 522
       <provider selected="true" editor-type-id="text-editor">
425  
-        <state line="127" column="36" selection-start="3865" selection-end="3865" vertical-scroll-proportion="0.0">
  523
+        <state line="80" column="56" selection-start="2357" selection-end="2357" vertical-scroll-proportion="1.4586357">
426 524
           <folding />
427 525
         </state>
428 526
       </provider>
429 527
     </entry>
430  
-    <entry file="file://$PROJECT_DIR$/README.rdoc">
  528
+    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/follower.rb">
431 529
       <provider selected="true" editor-type-id="text-editor">
432  
-        <state line="53" column="83" selection-start="1649" selection-end="1649" vertical-scroll-proportion="0.0">
  530
+        <state line="88" column="42" selection-start="2821" selection-end="2821" vertical-scroll-proportion="-0.27906978">
433 531
           <folding />
434 532
         </state>
435 533
       </provider>
436 534
     </entry>
437  
-    <entry file="file://$PROJECT_DIR$/spec/mongo/followable_spec.rb">
  535
+    <entry file="file://$PROJECT_DIR$/lib/mongo_followable/followable.rb">
438 536
       <provider selected="true" editor-type-id="text-editor">
439  
-        <state line="216" column="9" selection-start="4887" selection-end="4887" vertical-scroll-proportion="0.7826087">
  537
+        <state line="87" column="54" selection-start="2798" selection-end="2798" vertical-scroll-proportion="1.3255814">
440 538
           <folding />
441 539
         </state>
442 540
       </provider>
5  README.rdoc
Source Rendered
@@ -76,6 +76,11 @@ Getting a model's followers/followees by type is also possible:
76 76
     @group.followers_by_type("user")
77 77
     @user.followees_by_type("group")
78 78
 
  79
+For inherited model:
  80
+
  81
+    @group.followers_by_type("user_post") # both are fine
  82
+    @user.followees_by_type("GroupPost")
  83
+
79 84
 And their count:
80 85
 
81 86
     @group.followers_by_type("user")
2  app/models/follow.rb
@@ -14,6 +14,6 @@ class Follow
14 14
   belongs_to :followable, :polymorphic => true
15 15
   belongs_to :following, :polymorphic => true
16 16
 
17  
-  scope :by_type, lambda { |type| where(:f_type => type.capitalize) }
  17
+  scope :by_type, lambda { |type| where(:f_type => type.safe_capitalize) }
18 18
   scope :by_model, lambda { |model| where(:f_id => model.id.to_s).by_type(model.class.name) }
19 19
 end
2  lib/mongo_followable.rb
@@ -2,6 +2,8 @@
2 2
 #require "mongo_followable/follower"
3 3
 #require "../app/models/follow"
4 4
 
  5
+
  6
+require File.join(File.dirname(__FILE__), "mongo_followable/string_ext")
5 7
 require File.join(File.dirname(__FILE__), "mongo_followable/followable")
6 8
 require File.join(File.dirname(__FILE__), "mongo_followable/follower")
7 9
 require File.join(File.dirname(__FILE__), "../app/models/follow")
7  lib/mongo_followable/followable.rb
@@ -77,14 +77,15 @@ def method_missing(name, *args)
77 77
 
78 78
     def set_authorization(*models)
79 79
       models.each do |model|
80  
-        self.cannot_followed << model.capitalize
  80
+
  81
+        self.cannot_followed << model.safe_capitalize
81 82
       end
82 83
       self.save
83 84
     end
84 85
 
85 86
     def unset_authorization(*models)
86 87
       models.each do |model|
87  
-        self.cannot_followed -= [model.capitalize]
  88
+        self.cannot_followed -= [model.safe_capitalize]
88 89
       end
89 90
       self.save
90 91
     end
@@ -196,7 +197,7 @@ def common_followers_with(model)
196 197
       def rebuild_instances(follows)
197 198
         follow_list = []
198 199
         follows.each do |follow|
199  
-          follow_list << follow.f_type.capitalize.constantize.find(follow.f_id)
  200
+          follow_list << follow.f_type.constantize.find(follow.f_id)
200 201
         end
201 202
         follow_list
202 203
       end
6  lib/mongo_followable/follower.rb
@@ -77,7 +77,7 @@ def method_missing(name, *args)
77 77
 
78 78
     def set_authorization(*models)
79 79
       models.each do |model|
80  
-        self.cannot_follow << model.capitalize
  80
+        self.cannot_follow << model.safe_capitalize
81 81
       end
82 82
       self.save
83 83
     end
@@ -86,7 +86,7 @@ def set_authorization(*models)
86 86
 
87 87
     def unset_authorization(*models)
88 88
       models.each do |model|
89  
-        self.cannot_follow -= [model.capitalize]
  89
+        self.cannot_follow -= [model.safe_capitalize]
90 90
       end
91 91
       self.save
92 92
     end
@@ -219,7 +219,7 @@ def common_followees_with(model)
219 219
       def rebuild_instances(follows)
220 220
         follow_list = []
221 221
         follows.each do |follow|
222  
-          follow_list << follow.f_type.capitalize.constantize.find(follow.f_id)
  222
+          follow_list << follow.f_type.constantize.find(follow.f_id)
223 223
         end
224 224
         follow_list
225 225
       end
19  lib/mongo_followable/string_ext.rb
... ...
@@ -0,0 +1,19 @@
  1
+class String
  2
+  if defined? safe_capitalize
  3
+    alias safe_capitalize_original safe_capitalize
  4
+  end
  5
+
  6
+  def capitalized?
  7
+    self[0].ord > 64 && self[0].ord < 91
  8
+  end
  9
+
  10
+  def safe_capitalize
  11
+    if self.include? "_"
  12
+      self.split("_").map(&:capitalize).join
  13
+    elsif self[0].capitalized?
  14
+      self
  15
+    else
  16
+      self.capitalize
  17
+    end
  18
+  end
  19
+end
2  lib/mongo_followable/version.rb
... ...
@@ -1,3 +1,3 @@
1 1
 module MongoFollowable
2  
-  VERSION = "0.2.3"
  2
+  VERSION = "0.2.4"
3 3
 end
30  spec/mongo/followable_spec.rb
@@ -217,4 +217,34 @@
217 217
       end
218 218
     end
219 219
   end
  220
+
  221
+  describe ChildUser do
  222
+
  223
+    context "begins" do
  224
+
  225
+      before do
  226
+        @u = ChildUser.new
  227
+        @u.save
  228
+
  229
+        @w = User.new
  230
+        @w.save
  231
+
  232
+        @g = Group.new
  233
+        @g.save
  234
+      end
  235
+
  236
+
  237
+      it "inherited model test" do
  238
+        @u.follow(@v, @w, @g) {|m| m.class == User}
  239
+
  240
+        @u.all_followees.should == [@w]
  241
+
  242
+        @u.followees_by_type("user") == [@w]
  243
+
  244
+        @w.followers_by_type("child_user") == [@u]
  245
+        @w.followers_by_type("childUser") == [@u]
  246
+        @w.followers_by_type("ChildUser") == [@u]
  247
+      end
  248
+    end
  249
+  end
220 250
 end
5  spec/mongo_mapper/childuser.rb
... ...
@@ -0,0 +1,5 @@
  1
+class ChildUser
  2
+  include MongoMapper::Document
  3
+  include Mongo::Followable
  4
+  include Mongo::Follower
  5
+end
5  spec/mongoid/childuser.rb
... ...
@@ -0,0 +1,5 @@
  1
+class ChildUser
  2
+  include Mongoid::Document
  3
+  include Mongo::Followable
  4
+  include Mongo::Follower
  5
+end
2  spec/spec_helper.rb
@@ -10,6 +10,7 @@
10 10
   require File.expand_path("../../lib/mongo_followable", __FILE__)
11 11
   require File.expand_path("../mongoid/user", __FILE__)
12 12
   require File.expand_path("../mongoid/group", __FILE__)
  13
+  require File.expand_path("../mongoid/childuser", __FILE__)
13 14
   Mongoid.configure do |config|
14 15
     name = 'mongo_followable_test'
15 16
     host = 'localhost'
@@ -22,6 +23,7 @@
22 23
   require File.expand_path("../../lib/mongo_followable", __FILE__)
23 24
   require File.expand_path("../mongo_mapper/user", __FILE__)
24 25
   require File.expand_path("../mongo_mapper/group", __FILE__)
  26
+  require File.expand_path("../mongo_mapper/childuser", __FILE__)
25 27
   MongoMapper.database = 'mongo_followable_test'
26 28
 end
27 29
 

0 notes on commit 44f884d

Please sign in to comment.
Something went wrong with that request. Please try again.