I am going crazy. I have the below two methods in my tag model.
Within the console my Tag.create_for :location => “Toronto” works but
soon as I put this code in my application I get the following error:
NoMethodError in UserController#set_user_fetish_list; undefined method
`make_url_safe’ for Tag:Class
Does that make sense… especially since in works in the console? HELP!
class Tag < ActiveRecord::Base
def Tag.create_for(options)
if options[:fetish]
self.create(:name => options[:fetish], :url_safe =>
make_url_safe(), :category => “fetish”)
elsif options[:location]
self.create(:name => options[:location], :url_safe =>
make_url_safe(options[:location]), :category => “location”)
end
end
private
def make_url_safe(str)
str.gsub(/\s/, “_”)
end
end
Thanks for your help!
–
John K.
[email protected]