Created
October 8, 2014 21:38
-
-
Save mark-dce/6e96f6188292ea897953 to your computer and use it in GitHub Desktop.
Namespacing problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
With a gemfile like this: | |
source 'https://rubygems.org' | |
gem 'nokogiri', '~> 1.6.3.1' | |
.... | |
And a model defined like this | |
class Record < ActiveRecord::Base | |
def to_pbcore_xml | |
xml = '<?xml version="1.0"?><pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html"></pbcoreDescriptionDocument>' | |
Nokogiri::XML(xml) | |
end | |
end | |
I'm getting an error like this | |
NameError in RecordsController#show | |
uninitialized constant Record::Nokogiri | |
Extracted source (around line #22): | |
def to_pbcore_xml | |
xml = '<?xml version="1.0"?><pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html"></pbcoreDescriptionDocument>' | |
Nokogiri::XML(xml) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment