Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dm-devise

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dm-devise

  • 2.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= dm-devise

dm-devise lets you use devise (http://github.com/plataformatec/devise) with DataMapper.

dm-devise is intended for use with Rails >= 3.2 and devise >= 2.1.

This README only covers dm-devise specifics. Make sure to read the devise README http://github.com/plataformatec/devise/blob/master/README.rdoc

Last tested against devise master: 2013-03-22, commit 72cbafa3225bab8904d62df9b1f5cbaaa0322931 Last tested against devise release 2.2.3

== Installation

Add dm-devise and dm gems to your Gemfile. The following gems are required:

gem 'dm-core', '> 1.2.0' gem 'dm-sqlite-adapter', '> 1.2.0' # or your preferred adapter gem 'dm-serializer', '> 1.2.0' gem 'dm-timestamps', '> 1.2.0' gem 'dm-rails', '> 1.2.0' gem 'dm-validations', '> 1.2.0' # Do not include if using data_mapper_active_model gem 'dm-devise', '~> 2.1.0'

If you're using Active Model validations, do not include dm-validations in your Gemfile.

dm-devise works with versions of DataMapper gems >= 1.0.2 on the 1.0 branch,

= 1.1.0.rc3 on the 1.1 branch and 1.2.0.

Run the generator:

rails generate data_mapper:devise_install

The generator will install an initializer which describes ALL Devise's configuration options and you MUST take a look at it. See Config section below for three config options that have particular importance to dm-devise.

Add Devise to any of your models using the generator:

rails generate data_mapper:devise MODEL

Read the README for devise at http://github.com/plataformatec/devise/blob/master/README.rdoc

== Using raise_on_save_failure

The default controllers provided by devise will not work correctly if raise_on_save_failure is set to true for the devise model. You can customize the controllers (See the devise README for details), but I don't know what customizations in particular to recommend. See https://github.com/jm81/dm-devise/issues/14 for discussion.

== Config Options

See the generated initializer for all the config options, but dm-devise users should be particularly aware of these three:

=== data_mapper_validation_lib

dm-devise adds some compatibility methods for either dm-validations or Active Model validations. By default, it determines what to load based on which library is found (giving preference to dm-validations). You may explicitly set this to 'dm-validations' or 'active_model', or false to not load any of the validations compatibility code. Details of the options:

dm-validations:: Uses dm-validations. This involves a bit of monkey-patching, but you need to use this if you want auto-validations in any of your models. active_model:: Uses ActiveModel::Validations. Do not use if you require 'dm-validations' anywhere in your app (or include it in your Gemfile). Things will break. The advantage to this is Active Model's I18n support for error messages, and it uses the same validations lib as devise does by default.

=== data_mapper_validation_messages

Messages to use as the default DataMapper validation error messages. The messages are updated from those included in dm-validations to be consistent with ActiveModel (i.e. with the Devise test expectations) and include additional messages that devise uses (:not_found, :already_confirmed, :not_locked, and :expired). If set to false, the messages are left as defined by the dm-validations gem.

== TODO

  • Example app
  • Rails templates

== Testing

The dm-devise test rake task runs all of devise's tests using the data_mapper ORM with both dm-validations and active_model validations (you can specify one with rake test VALIDATION_LIB=lib_name). In order to run tests, you'll need a local copy of devise (a gem is fine as long as you specify the path). By default, dm-devise looks for devise in [path-to-dm-devise]/../devise. You can override this by setting a DEVISE_PATH env variable. For example:

rake test DEVISE_PATH=/path/to/devise

== 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

== Contributors

http://github.com/jm81/dm-devise/contributors

== Bugs and Feedback

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

http://github.com/jm81/dm-devise/issues

== Copyright

Copyright (c) 2010-2011 Jared Morgan. See LICENSE for details.

FAQs

Package last updated on 25 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc