fixes #817
This commit is contained in:
@@ -837,17 +837,24 @@ class Post < ActiveRecord::Base
|
|||||||
options ||= {}
|
options ||= {}
|
||||||
options[:except] ||= []
|
options[:except] ||= []
|
||||||
options[:except] += hidden_attributes
|
options[:except] += hidden_attributes
|
||||||
|
# options[:methods] += [:uploader_name, :has_large]
|
||||||
hash = super(options)
|
hash = super(options)
|
||||||
hash["uploader_name"] = uploader_name
|
|
||||||
hash["has_large"] = has_large
|
|
||||||
hash
|
hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_json(options = {})
|
||||||
|
options ||= {}
|
||||||
|
options[:methods] ||= []
|
||||||
|
options[:methods] += [:uploader_name, :has_large]
|
||||||
|
super(options)
|
||||||
|
end
|
||||||
|
|
||||||
def to_xml(options = {}, &block)
|
def to_xml(options = {}, &block)
|
||||||
# to_xml ignores the serializable_hash method
|
# to_xml ignores the serializable_hash method
|
||||||
options ||= {}
|
options ||= {}
|
||||||
options[:except] ||= []
|
options[:procs] ||= []
|
||||||
options[:except] += hidden_attributes
|
options[:procs] << lambda {|options, record| options[:builder].tag!("uploader-name", record.uploader_name)}
|
||||||
|
options[:procs] << lambda {|options, record| options[:builder].tag!("has-large", record.has_large?, :type => "boolean")}
|
||||||
super(options, &block)
|
super(options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user