Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
83cacd72
Commit
83cacd72
authored
Jul 17, 2012
by
Derrick Reimer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JRuby compatibility
By default, ObjectSpace.each_object is disabled in JRuby. However, ObjectSpace.each_object(Class) still works.
parent
bef0c494
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
annotate_models.rb
lib/annotate/annotate_models.rb
+2
-5
No files found.
lib/annotate/annotate_models.rb
View file @
83cacd72
...
...
@@ -316,11 +316,8 @@ module AnnotateModels
# Retrieve loaded model class by path to the file where it's supposed to be defined.
def
get_loaded_model
(
model_path
)
ObjectSpace
.
each_object
.
select
{
|
c
|
Class
===
c
and
# note: we use === to avoid a bug in activesupport 2.3.14 OptionMerger vs. is_a?
c
.
ancestors
.
include?
(
ActiveRecord
::
Base
)
}.
ObjectSpace
.
each_object
(
::
Class
).
select
{
|
c
|
c
.
ancestors
.
include?
(
ActiveRecord
::
Base
)
}.
detect
{
|
c
|
ActiveSupport
::
Inflector
.
underscore
(
c
)
==
model_path
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment