Module: Devise::Orm::MongoMapper::Compatibility

Extended by:
ActiveModel::Naming, ActiveSupport::Concern
Includes:
ActiveModel::Serializers::JSON, ActiveModel::Serializers::Xml
Defined in:
lib/devise/orm/mongo_mapper/compatibility.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#invalid?Boolean

def save(options=nil)

  if options.is_a?(Hash) && options[:validate] == false
    save!
  else
    super()
  end
end

def update_attribute(name, value)
  update_attributes(name => value)
end
# 
# def update_attributes(*args)
#   update(*args)
# end

Returns:

  • (Boolean)


83
84
85
# File 'lib/devise/orm/mongo_mapper/compatibility.rb', line 83

def invalid?
  !valid?
end

#to_xml(options = {}, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/devise/orm/mongo_mapper/compatibility.rb', line 13

def to_xml(options = {}, &block)
  options[:except] ||= []
  options[:except] << :_id

  super options do |b|
    b.id self.id
    block.call(b) if block_given?
  end
end