new cfpropertylist and added possibility for plist_filename
This commit is contained in:
parent
ef9275886e
commit
30931f0384
2 changed files with 8 additions and 4 deletions
|
@ -77,7 +77,7 @@ module CFPropertyList
|
||||||
def guess(object, options = {})
|
def guess(object, options = {})
|
||||||
if(object.is_a?(Fixnum) || object.is_a?(Integer)) then
|
if(object.is_a?(Fixnum) || object.is_a?(Integer)) then
|
||||||
return CFInteger.new(object)
|
return CFInteger.new(object)
|
||||||
elsif(object.is_a?(Float)) then
|
elsif(object.is_a?(Float) || object.is_a?(BigDecimal)) then
|
||||||
return CFReal.new(object)
|
return CFReal.new(object)
|
||||||
elsif(object.is_a?(TrueClass) || object.is_a?(FalseClass)) then
|
elsif(object.is_a?(TrueClass) || object.is_a?(FalseClass)) then
|
||||||
return CFBoolean.new(object)
|
return CFBoolean.new(object)
|
||||||
|
|
|
@ -28,11 +28,15 @@ module ActionController
|
||||||
|
|
||||||
if plist
|
if plist
|
||||||
|
|
||||||
|
unless options.nil? or options[:plist_filename].blank?
|
||||||
if plist.is_a? Array
|
if plist.is_a? Array
|
||||||
filename = plist.first.class.name.pluralize
|
filename = plist.first.class.name.pluralize
|
||||||
else
|
else
|
||||||
filename = "#{plist.class.name}-#{plist.id}"
|
filename = "#{plist.class.name}-#{plist.id}"
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
filename = options[:plist_filename]
|
||||||
|
end
|
||||||
|
|
||||||
send_data(
|
send_data(
|
||||||
plist.to_plist(options),
|
plist.to_plist(options),
|
||||||
|
|
Reference in a new issue