Giter Club home page Giter Club logo

mm-devise's Introduction

MongoMapper for Devise

mm-devise will let you use devise with MongoMapper.

mm-devise is intended for use with Rails 3+ and Devise 1.2 and above. It may work with earlier versions of devise.

This README only covers mm-devise specifics. Make sure to read the devise README

Status update, June 2011

Recently upgraded to (hopefully!) support Devise > 1.2 and MongoMapper 0.9.0.

Installation

Add devise, mm-devise and mongo_mapper gems to your Gemfile (your Rails app Gemfile).

gem 'mongo_mapper',           '~> 0.9.0'
# You'll want this to for better mongo driver performance
gem 'bson_ext'

gem 'devise',                 '~> 1.3.4'
gem 'mm-devise',              '~> 1.2.0'

Use bundler to install all required gems in your Rails 3 app

bundle install

Run the devise install generator, followed by the mm-devise model generator:

rails generate devise:install
rails generate mongo_mapper:devise MODEL

The devise install generator will install an initializer (config/inititializer/devise.rb) which describes ALL Devise's configuration options and you MUST take a look at it. Maker sure this line exists:

require 'devise/orm/mongo_mapper'

NOTE: The model generator should do this automatically.

To add Devise to any of your models using the generator:

rails generate mongo_mapper:devise MODEL

Example: create a User model for use with Devise

rails generate mongo_mapper:devise User

Read the README for devise at devise README

Test Driven Development - extending this project

To develop on this project using TDD, requires the following setup. Clone this project into a container folder, fx /projects, so you have fx /projects/mm-devise In the same container folder clone devise from github

Example:

git clone http://github.com/kristianmandrup/mm-devise.git
git clone http://github.com/plataformatec/devise.git
cd mm-devise
bundle install
rake test

Gem install

$ rake install

Gem release (push to RubyGems)

$ gem push pkg/mm-devis-xxxx.gem

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Maintainers

Kristian Mandrup

Contributors

bmarini - Updated to support MongoMapper 0.9 (June 2011) bhbryant - Fixed some issues and updated gem (Jan 2011) Jared Morgan - Created the dm-devise gem which was used as a template for the development of this gem. Also made suggestions for a few critical fixes and improvements in the code. Thanks :)

Bugs and Feedback

For mm-devise specific issues, please create an issue on GitHub at: mm-devise issues

Copyright

Copyright (c) 2010 Kristian Mandrup. See LICENSE for details.

mm-devise's People

Contributors

bmarini avatar digioi avatar kristianmandrup avatar pollingj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mm-devise's Issues

assign_attributes called instead of update_attributes

heartcombo/devise#1894

Essentially this change means that you cannot edit a user without inputting the password (or if you forget to put in the password it errors out).

I'm not comfortable enough with Devise to suggest a fix. I deleted self.assign_attributes(params, *options) in devise /lib/devise/models/database_authenticatable.rb as a band-aid

bson_ext dependency

If I am using mongomapper 0.8.6 I cannot use bson_ext 1.1.1 as ~> will not go there;
should bson_ext even be a dependency for this gem?

cheers

undefined method to_adapter on devise 1.2.0

I was trying to use the edge version of devise and it looks like some of the internals changed and now it blows up when trying to call to_adapter in the registrations controller

error with Device:schema on heroku

app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/mm-devise-1.3/lib/devise/orm/mongo_mapper.rb:24:in `module:Schema': no such file to load -- devise/schema (LoadError)

undifined method 'changed?' for embedded document

I tried to use an embedded document with devise.
It seams somewhere "changed?" method is used.

My model as got this :
devise :database_authenticatable, :registerable, :rememberable, :trackable, :validatable
I think that the rememberable feature is responsible of the trouble. <= I just remove it and it works without

A quick console test showed me Embedded document do not have any "changed?" method, instead of Documents who get it.
I checkout the rememberable source, I can't catch where the missing func could be called. "changed?" is at least used in devise in rememberable_test.rb

I fixed the probleme adding a dirty def changed? false; end to my model but ... it's not really wise ...

Broken by Devise 1.2.0

Devise's use of orm_adapter appears to have broken mm-devise. orm_adapter introfuces a "to_adapter" method that is created on the Devise-enabled class. It appears that mm-devise would have to do something similar. However, orm_adapter predictably does not support mongomapper.

How can I remove mm-devise and restore original devise settings?

I've tried a number of things including reinstalling all of my gems but when I:

(a) run "rails generate devise:install", my initializer file still has 'devise/orm/mongo_mapper' as default

(b) run "rails generate devise User" having corrected the initializer, I am seeing "error mongo_mapper [not_found]"

I'm in the process of moving my entire application from mongomapper to mongoid so is it possible there's some configuration/setting somewhere that I haven't been able to track down? Thanks in advance for your help

Devise 2.1

The current gem isn't working with Devise 2.1 I've update my fork to work with it - https://github.com/pollingj/mm-devise, however I'm not submitting a pull request as it's failing on about 7 tests. Nothing major, but I'm slightly at a loss as to why it's failing. If anyone fancies looking at my fork and fixing, please feel free to do so.

John

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.