lib/cytoplasm/ajax.rb in cytoplasm-0.0.7 vs lib/cytoplasm/ajax.rb in cytoplasm-0.0.9
- old
+ new
@@ -10,22 +10,20 @@
module ClassMethods
# notice: no self.method_name here, because this is being extended because ActiveSupport::Concern was extended
end
# instance methods to go on every controller go here
- def self.ajax_success(message=false,data={})
- puts "Ajax Success function called!"
+ def self.success(message=false,data={})
output = {"status" => "OK"}
unless message.is_a? String or message==false
data = message
message = false
end
output["message"] = message if message.is_a? String and message!=""
data.each {|k,v| output[k] = v if data.key?(k)} unless data.empty?
return output.to_json
end
- def self.ajax_error(message=false)
- puts "Ajax Error function called!"
+ def self.error(message=false)
output = {"status" => "Error"}
output["message"] = message if message.is_a? String and message != ""
return output.to_json
abort
end
\ No newline at end of file