Skip to content

Commit

Permalink
MongoMapper ORM for devise
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Sep 22, 2010
0 parents commit 53a5d17
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
pkg/*
*.gem
.bundle
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source :gemcutter
gemspec
24 changes: 24 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,24 @@
PATH
remote: .
specs:
devise-mongo_mapper (0.0.1)
devise (~> 1.1.0)

GEM
remote: http://rubygems.org/
specs:
bcrypt-ruby (2.1.2)
devise (1.1.1)
bcrypt-ruby (~> 2.1.2)
warden (~> 0.10.7)
rack (1.2.1)
warden (0.10.7)
rack (>= 1.0.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.0.0)
devise (~> 1.1.0)
devise-mongo_mapper!
2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
17 changes: 17 additions & 0 deletions devise-mongo_mapper.gemspec
@@ -0,0 +1,17 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'devise-mongo_mapper'
s.version = '0.0.1'
s.platform = Gem::Platform::RUBY
s.authors = ['Brandon Keepers']
s.email = ['brandon@collectiveidea.com']
s.homepage = "http://github.com/collectiveidea/devise-mongo_mapper"
s.summary = "MongoMapper ORM for devise"
s.files = Dir.glob('lib/**/*')
s.require_path = 'lib'

s.required_rubygems_version = ">= 1.3.6"

s.add_dependency "devise", "~> 1.1.0"
s.add_development_dependency "bundler", ">= 1.0.0"
end
1 change: 1 addition & 0 deletions lib/devise-mongo_mapper.rb
@@ -0,0 +1 @@
require 'devise/orm/mongo_mapper'
33 changes: 33 additions & 0 deletions lib/devise/orm/mongo_mapper.rb
@@ -0,0 +1,33 @@
module Devise
module Orm
module MongoMapper
module Hook
def devise_modules_hook!
extend Schema
yield
return unless Devise.apply_schema
devise_modules.each { |m| send(m) if respond_to?(m, true) }
end
end

module Schema
include Devise::Schema

# Tell how to apply schema methods
def apply_devise_schema(name, type, options={})
type = Time if type == DateTime
key name, type, options
end
end
end
end
end

module MongoMapper
module Devise
module ClassMethods
include ::Devise::Models
include ::Devise::Orm::MongoMapper::Hook
end
end
end

0 comments on commit 53a5d17

Please sign in to comment.