Devise / DataMapper updates

allows devise to work with the upcoming dm-validation changes
This commit is contained in:
Jacques Crocker 2010-03-28 14:59:59 -07:00
parent 6d31e368bf
commit 1c39590e20
4 changed files with 14 additions and 8 deletions

View File

@ -21,7 +21,6 @@ end
group :data_mapper do
gem 'do_sqlite3', '>= 0.10.1'
gem "dm-core", :git => "git://github.com/datamapper/dm-core.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-rails", :git => "git://github.com/datamapper/dm-rails.git"

View File

@ -77,10 +77,6 @@ module Devise
dirty?
end
def new_record?
new?
end
def save(options=nil)
if options.is_a?(Hash) && options[:validate] == false
save
@ -88,6 +84,14 @@ module Devise
super()
end
end
def update_attributes(*args)
update(*args)
end
def lock!
self.reload
end
end
end
end

View File

@ -1,5 +1,5 @@
class Admin
include DataMapper::Resource
include DataMapper::Resource
property :id, Serial
property :username, String

View File

@ -6,9 +6,8 @@ class User
devise :authenticatable, :http_authenticatable, :confirmable, :lockable, :recoverable,
:registerable, :rememberable, :timeoutable, :token_authenticatable,
:trackable
:trackable, :validatable
# :validatable disabled for now
timestamps :at
def save!(*args)
@ -18,4 +17,8 @@ class User
def self.create!(*args)
create(*args)
end
def self.destroy_all
all.destroy
end
end