1

I'm developing a Rails application and want to create some classes that can be called from my controller. But, whenever I make changes to those external files, I always have to restart my server. I can make changes to the controller itself and basically any other file without issue.

Notice the following two screenshots. The thing that gets me is that even the extracted source preview shows the line has been removed, and yet it behaves as though the line was there (until I restart my server).

Before change: Before change

After change: After change

This is my controller

class EvaluationObject
def self.raise_error
    raise "this is an error".inspect
end

And this is the class method I'm calling.

def show
    EvaluationObject.raise_error
end

I already checked out "Why does Rails not refresh classes on every request (despite configuration)?" and "Rails Server needs restart every time I make changes? why?" and none of the solutions worked for me. I tend to believe I'm missing something obvious. Any thoughts?

Edit: These .rb files are in the same directory as my controllers. I've also put them in the concerns directory.

Community
  • 1
  • 1
Mourkeer
  • 111
  • 3
  • 8
  • 1
    Where do these `.rb` files live in your project? – ptd Dec 12 '14 at 16:29
  • 2
    Instead of saying things like "this SO post" and "this one as well", use more descriptive anchor text. Let people know where they're going or what they'll see. Read '[Don't use "click here" as link text](http://www.w3.org/QA/Tips/noClickHere)' along with the links at the bottom of the page. – the Tin Man Dec 12 '14 at 16:33
  • Does [this post about `autoload_paths`](http://demisx.github.io/rails/2014/03/16/auto-reload-classes-custom-directories.html) help? – D-side Dec 12 '14 at 16:41
  • @ptd These files are all in the same controllers directory. I had them in the concerns subdirectory as well, to no avail. – Mourkeer Dec 12 '14 at 17:26

0 Answers0