Sha256: 792a21ae42e318e951bb54e6b0bd39d971e0728fbadc0a801f655565f5f1e5f4

Contents?: true

Size: 377 Bytes

Versions: 3

Compression:

Stored size: 377 Bytes

Contents

class ActiveRecord::Base
    # Converts the ActiveRecord object to a JSON string. Only columns with simple
    # types are included in this object so no recursion problems can occur.
    def to_json(*a)
      result = Hash.new  
      self.class.columns.each do |column|
        result[column.name.to_sym] = self.send(column.name)
      end
      result.to_json(*a)
    end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
appcelerator-2.0.1.1 lib/appcelerator/active_record_extension.rb
appcelerator-2.0.2 lib/appcelerator/active_record_extension.rb
seamless-1.0.0 lib/seamless/active_record_extension.rb