Module: RestfulX::ActiveRecord::InstanceMethods

Defined in:
lib/restfulx/rx_active_record.rb

Instance Method Summary collapse

Instance Method Details

#to_amf(options = {}) ⇒ Object

serialize this model as AMF



273
274
275
276
277
278
# File 'lib/restfulx/rx_active_record.rb', line 273

def to_amf(options = {})
  default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at]
  options[:except] = (options[:except] ? options[:except] + default_except : default_except)
  
  RestfulX::Serialization::AMFSerializer.new(self, options).to_s
end

#to_fxml(options = {}) ⇒ Object

serialize this model as fXML



281
282
283
284
285
286
287
# File 'lib/restfulx/rx_active_record.rb', line 281

def to_fxml(options = {})
  options.merge!(:dasherize => false)
  default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at, :created_at, :updated_at]
  options[:except] = (options[:except] ? options[:except] + default_except : default_except)
  
  RestfulX::Serialization::FXMLSerializer.new(self, options).to_s
end

#unique_idObject



268
269
270
# File 'lib/restfulx/rx_active_record.rb', line 268

def unique_id
  "#{self.class.to_s}_#{self.attributes()['id']}"
end