RubyMine dependency problem running individual files


#1

I’m using RubyMine to browse the project files. All the tests work fine and I can run the spec files, debug, set breakpoints on them etc. However when I run non Rspec files such as those from the model, controllers or lib directory I get a `require_dependency’ error:

~/Documents/discourse/lib/post_creator.rb:3:in<top (required)>’: undefined method require_dependency' for main:Object (NoMethodError)

I’ve searched around and couldn’t find an answer. How can I resolve this?


(Alan Tan) #2

How did you “run non RSpec files”? :confused: :thought_balloon:

require_dependency is defined in ActiveSupport::Dependencies so you’ll have to load that module as well.


(James Kiesel) #3

I don’t think you’ll get anywhere trying to run individual files; Discourse is meant to be run as an application. Have you checked out Discourse as Your First Rails App ?


(Matt Palmer) #4

That’s not how Rails projects work. You run the entire application together, and there is code built-in which selects which portions of code get run for each individual HTTP request that the built-in HTTP server receives.