rosenfeld / sequel-devise Goto Github PK
View Code? Open in Web Editor NEWDevise support for Sequel models
License: MIT License
Devise support for Sequel models
License: MIT License
sequel-devise devise dependency should be locked in gemspec. Thing is I am having a hard time setting devise with sequel and it could be due to devise version. I would need to know if there is a devise version that works with this gem and if thus it may be a good idea to have it locked in the gemspec.
when i use has_many :model
it would generate this error:
/home/muhammad/devel/quadifi/app/models/user.rb:12:in `<class:User>': undefined method `has_many' for User:Class (NoMethodError)
from /home/muhammad/devel/quadifi/app/models/user.rb:1:in `<top (required)>'
when i comment it out, my app works okay. :)
i don't think i need belongs_to as the devise model is the main model for all my user accounting and i'm unsure if anyone needs attr_accessible anyway.
$ rails g devise User
error sequel [not found]
route devise_for :users
Normal generation works fine though. (having the Sequel.migration in migration file)
$ rails g migration AddTestToPrepaids test:integer
invoke sequel
create db/migrate/20131209092231_add_test_to_prepaids.rb
(i am using sequel-rails with sequel-devise)
just posted a plugin that fixes the issue i'll outline below but think it may be better off rolled into your gem instead of sitting as its own plugin. what do you think?
basically i ran into an exception when including the devise confirmable module (using sequel 4.7 and devise 3.2.2)
i'll just copy and paste from the readme over at the repo i mentioned:
A class as simple as:
class User < Sequel::Model
plugin :devise
devise :database_authenticatable, :confirmable
end
would cause an exception:
wrong number of arguments (2 for 0..1)
I tracked the issue down to some code in devise:
before_create :generate_confirmation_token, :if => :confirmation_required?
that code uses a hook syntax with 2 arguments (:generate_confirmation_token
and a hash of {:if => :confirmation_required?}
) that's not supported by Sequel!
Just so that you are aware: heartcombo/devise#4187
This is quite ugly and is probably something that the devise guys will fix shortly, but that #serializable_hash thing seems important. Or maybe not? Should it be reimplemented here, or it's not policy of the gem to patch all methods out of the scope of active model and orm adapter?
validatable makes a call to email_changed?
(requires ActiveModel::Dirty )
including the sequel dirty plugin is a start but the sequel and ar apis are different. sequel has a column_changed?(:name)
method whereas ar adds an #{COLUMN_NAME}_changed?
method for each column.
i think sequel-devise should include the dirty plugin and add a #{COLUMN_NAME}_changed?
method for each column that then calls column_changed?(#{COLUMN_NAME})
It appears that last week changes were made to handle validation failures when updating an object. But no such changes were added for handling Sequel::ValidationFailed when saving a new user (during sign up, for example).
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/devise-3.2.2/lib/devise/models/validatable.rb:44:in `assert_validations_api!': Could not use :validatable module since User does not respond to the following methods: validates_presence_of, validates_uniqueness_of, validates_format_of, validates_confirmation_of, and validates_length_of. (RuntimeError)
using sequel-rails and sequel-devise
I had to disable password resets for now (if the user forgets his password) because when i use
devise: recoverable
The error that shows is
undefined method `encrypted_password_changed?' for #<User:0x0000000a947eb0>
Traceback:
included do
before_save do
if email_changed? || encrypted_password_changed?
clear_reset_password_token
end
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.