0

I am noticing a pattern of rails acting as if a line of code is still written once it has been deleted, and I think it may have something to do with changing its defaults too much. I have two examples.

In the first, I set config.force_ssl => true in my config file (a major mistake) and immediately got an error on a page where I was introducing an api via a script tag:

My server gave me an error because the response length of the input wasn't known. I tried enabling streaming in my controller, and it failed. I even tried setting config.force_ssl => false, but this too was useless. So, I deleted the config.force_ssl => true line, but in Firefox, the page with the error continued to route to an "https://" url and then give me the same error. Chromium did not, so I switched to using that, but to this day, I still cannot load the page in Firefox without an error.

Now for the second issue. More recently, I created a model where I wanted to create a custom initialize method with four parameters.

association.rb

def initialize(tag_index, relative_index, type, relevance)
  #assigning variables
end

In my controller, I assigned these accordingly.

tags_controller.rb

a = Association.new(id, tag_two.id, type, relevance)

Immediately, I get an error that I have 4 for 2 parameters. Thinking it's just rails being picky, I take away "type" and "relevance." Now, though, I get an error message telling me there is no method 'check_validity!' for class 30:Fixnum. So, I remove the initialize function altogether, and just as before, Rails refuses to recognize that the lines of code have been deleted, giving me errors when I enter parameters for Association.new, and telling me I'm missing parameters when I don't enter any at all.

If anyone can help with the little pieces such as how to fix a response length error with ssl, or how to deal with the 'check_validity!' method, that would be great. Better, though, would be if someone could explain why Rails refuses to let old pieces of code be deleted. This is something that has frustrated me to no end, and I can't find anything on any of these forums about how to fix it.

Thanks so much!

  • After you change code, you should restart the server process. In development mode rails should pick up most changes automatically, but restart won't hurt. – Sergio Tulentsev May 24 '13 at 22:01
  • No, I mean, I've been restarting. I've been running Unicorn lately and I've been even trying restarting it with bundle exec just to make sure things get refreshed. Doesn't seem to be doing anything. – user2384585 May 24 '13 at 22:19

0 Answers0