lib/rooftop/resource_links/link.rb in rooftop-0.1.2 vs lib/rooftop/resource_links/link.rb in rooftop-0.1.3
- old
+ new
@@ -14,9 +14,13 @@
if @mapped_class
# If this link has an ID, we can call find() on the class
if respond_to?(:id)
return @mapped_class.send(:find, id)
else
+ # TODO this is a fudge to get around some hrefs which don't have /wp/v2 in them
+ unless href =~ /wp\/v2/
+ href.gsub!('wp-json','wp-json/wp/v2')
+ end
# otherwise we're going to have make a call to the link's href.
result = @mapped_class.get(href)
result.run_callbacks(:find)
return result
end