Permalink
Browse files

Merge pull request #11 from andreaspe/master

XML Parsing fix if a rails resource contains underscores rather than CamelCase
  • Loading branch information...
2 parents ec52c2b + b232856 commit 67d32d50914fe4b3550cb0467fe16a9bc19ee2be @jbroadway committed Oct 20, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 ActiveResource.php
View
@@ -531,8 +531,8 @@ function _send_and_receive ($url, $method, $data = array ()) {
// parse XML response
$xml = new SimpleXMLElement ($res);
-
- if ($xml->getName () == $this->element_name_plural) {
+ // normalize xml element name in case rails ressource contains an underscore
+ if (str_replace("-","_", $xml->getName ()) == $this->element_name_plural) {
// multiple
$res = array ();
$cls = get_class ($this);
@@ -670,4 +670,4 @@ function set ($k, $v = false) {
}
}
-?>
+?>

0 comments on commit 67d32d5

Please sign in to comment.