Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed bug where all setters were saving as strings even if an object …

…was submitted
  • Loading branch information...
commit 0a5dd5c26a2ce203694153f292583e60f29cb75a 1 parent 7c6180d
@kevinvangelder kevinvangelder authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/parse_resource/base.rb
View
6 lib/parse_resource/base.rb
@@ -60,7 +60,7 @@ def self.field(fname, val=nil)
unless self.respond_to? "#{fname}="
class_eval do
define_method("#{fname}=") do |val|
- set_attribute("#{fname}", "#{val}")
+ set_attribute("#{fname}", val)
val
end
@@ -92,7 +92,7 @@ def to_pointer
def create_setters!(k,v)
unless self.respond_to? "#{k}="
self.class.send(:define_method, "#{k}=") do |val|
- set_attribute("#{k}", "#{val}")
+ set_attribute("#{k}", val)
val
end
@@ -253,6 +253,8 @@ def self.upload(file_instance, filename, options={})
options[:content_type] ||= 'image/jpg' # TODO: Guess mime type here.
file_instance = File.new(file_instance, 'rb') if file_instance.is_a? String
+ filename = filename.parameterize
+
private_resource = RestClient::Resource.new "#{base_uri}/#{filename}", app_id, master_key
private_resource.post(file_instance, options) do |resp, req, res, &block|
return false if resp.code == 400
Please sign in to comment.
Something went wrong with that request. Please try again.