Merge pull request #81 from nbit001/fix_incompabilities
Fix mongoid and mongo_mapper incompabilities.
This commit is contained in:
commit
3c2f789306
|
@ -10,8 +10,7 @@ module Impressionist
|
|||
end
|
||||
|
||||
initializer 'impressionist.model' do |app|
|
||||
require_orm
|
||||
ActiveRecord::Base.send(:include, Impressionist::Impressionable)
|
||||
require_and_include_orm
|
||||
|
||||
end
|
||||
|
||||
|
@ -27,7 +26,7 @@ module Impressionist
|
|||
|
||||
|
||||
private
|
||||
def require_orm
|
||||
def require_and_include_orm
|
||||
require "#{root}/app/models/impressionist/impressionable.rb"
|
||||
require "impressionist/models/#{orm}/impression.rb"
|
||||
require "impressionist/models/#{orm}/impressionist/impressionable.rb"
|
||||
|
@ -38,10 +37,10 @@ module Impressionist
|
|||
@orm = matcher(str.to_s)
|
||||
end
|
||||
|
||||
def matcher(str)
|
||||
def matcher(str)
|
||||
matched = str.match(/active_record|mongo_mapper|mongoid|/)
|
||||
matched[0]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
ActiveRecord::Base.send(:include, Impressionist::Impressionable)
|
||||
|
||||
module Impressionist
|
||||
module Impressionable
|
||||
extend ActiveSupport::Concern
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
MongoMapper::Document.plugin Impressionist::Impressionable
|
||||
|
||||
module Impressionist
|
||||
module Impressionable
|
||||
extend ActiveSupport::Concern
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Mongoid::Document.send(:include, Impressionist::Impressionable)
|
||||
|
||||
module Impressionist
|
||||
module Impressionable
|
||||
extend ActiveSupport::Concern
|
||||
|
|
Loading…
Reference in New Issue