0

I have a Model "Tag" that links to the dbpedia article for a particular topic. I want to create a virtual attribute that will use this dbpedia URI to generate a wikipedia URI. Here's roughly what the class looks like:

class Tag < ActiveRecord::Base

  # Validation
  validates_presence_of :dbpedia_uri, :label

  #Virtual Attribute
  def wikipedia_uri
    "#{dbpedia_uri}".gsub("dbpedia.org/resource", "wikipedia.org/wiki")    
  end

end

When I go into my console and try to check Tag.all[1].wikipedia_uri, I get the following error:

NoMethodError: undefined method `wikipedia_uri' for #<Tag:0xa0c79ac>

Additionally, I have a second Model (Map) with virtual attributes that do work, but when I change them, I still get the old value. So when the code is:

 def thumbnail_uri
    "#{map_base_uri}/thumbnails/#{identifier}.jpg"
  end

Map.all[1].thumbnail_uri returns something like: "http://WEBSITE/maps/thumbnails/g3201b.ct002662.jpg"

and when I change the code to:

def thumbnail_uri
   "test"
end

I still get the output: "http://WEBSITE/maps/thumbnails/g3201b.ct002662.jpg"

I've tried reloading my Rails Console, but it still doesn't seem to be updating the virtual attributes. Any thoughts on what could be causing this issue?

1 Answers1

0

Figured out the issue. I was stupidly running my console in a directory for a duplicate backup set of files, so all of the methods and variables from the backup were available in the console, but my changes to the current code weren't affecting it