mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Devise / DataMapper updates
allows devise to work with the upcoming dm-validation changes
This commit is contained in:
parent
6d31e368bf
commit
1c39590e20
4 changed files with 14 additions and 8 deletions
1
Gemfile
1
Gemfile
|
@ -21,7 +21,6 @@ end
|
||||||
group :data_mapper do
|
group :data_mapper do
|
||||||
gem 'do_sqlite3', '>= 0.10.1'
|
gem 'do_sqlite3', '>= 0.10.1'
|
||||||
gem "dm-core", :git => "git://github.com/datamapper/dm-core.git"
|
gem "dm-core", :git => "git://github.com/datamapper/dm-core.git"
|
||||||
|
|
||||||
gem "dm-validations", :git => "git://github.com/datamapper/dm-more.git"
|
gem "dm-validations", :git => "git://github.com/datamapper/dm-more.git"
|
||||||
gem "dm-timestamps", :git => "git://github.com/datamapper/dm-more.git"
|
gem "dm-timestamps", :git => "git://github.com/datamapper/dm-more.git"
|
||||||
gem "dm-rails", :git => "git://github.com/datamapper/dm-rails.git"
|
gem "dm-rails", :git => "git://github.com/datamapper/dm-rails.git"
|
||||||
|
|
|
@ -77,10 +77,6 @@ module Devise
|
||||||
dirty?
|
dirty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_record?
|
|
||||||
new?
|
|
||||||
end
|
|
||||||
|
|
||||||
def save(options=nil)
|
def save(options=nil)
|
||||||
if options.is_a?(Hash) && options[:validate] == false
|
if options.is_a?(Hash) && options[:validate] == false
|
||||||
save
|
save
|
||||||
|
@ -88,6 +84,14 @@ module Devise
|
||||||
super()
|
super()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_attributes(*args)
|
||||||
|
update(*args)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lock!
|
||||||
|
self.reload
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Admin
|
class Admin
|
||||||
include DataMapper::Resource
|
include DataMapper::Resource
|
||||||
|
|
||||||
property :id, Serial
|
property :id, Serial
|
||||||
property :username, String
|
property :username, String
|
||||||
|
|
|
@ -6,9 +6,8 @@ class User
|
||||||
|
|
||||||
devise :authenticatable, :http_authenticatable, :confirmable, :lockable, :recoverable,
|
devise :authenticatable, :http_authenticatable, :confirmable, :lockable, :recoverable,
|
||||||
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
||||||
:trackable
|
:trackable, :validatable
|
||||||
|
|
||||||
# :validatable disabled for now
|
|
||||||
timestamps :at
|
timestamps :at
|
||||||
|
|
||||||
def save!(*args)
|
def save!(*args)
|
||||||
|
@ -18,4 +17,8 @@ class User
|
||||||
def self.create!(*args)
|
def self.create!(*args)
|
||||||
create(*args)
|
create(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.destroy_all
|
||||||
|
all.destroy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue