Revision dc457681
Added by Joseph Magen almost 11 years ago
- ID dc45768149de1393f5b81f8d1ab8bb4583817791
app/models/concerns/fog_extensions/model.rb | ||
---|---|---|
module FogExtensions
|
||
module Model
|
||
def self.included(base)
|
||
base.send :include, InstanceMethods
|
||
base.class_eval do
|
||
attr_accessor :_delete
|
||
end
|
||
extend ActiveSupport::Concern
|
||
included do
|
||
attr_accessor :_delete
|
||
end
|
||
|
||
module InstanceMethods
|
||
|
||
def persisted?
|
||
!!identity
|
||
end
|
||
def persisted?
|
||
!!identity
|
||
end
|
||
|
||
def to_json(options={ })
|
||
ActiveSupport::JSON.encode(self, options)
|
||
end
|
||
def to_json(options={ })
|
||
ActiveSupport::JSON.encode(self, options)
|
||
end
|
||
|
||
def as_json(options = { })
|
||
attr = attributes.dup
|
||
attr.delete(:client)
|
||
attr
|
||
end
|
||
def as_json(options = { })
|
||
attr = attributes.dup
|
||
attr.delete(:client)
|
||
attr
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #2739 - add ActiveSupport::Concern syntax to mixins