GithubHelp home page GithubHelp logo

Comments (12)

timcharper avatar timcharper commented on September 24, 2024

Would it be out of the question to rework your inheritance scheme so that ApplicationController does inherit straight from "ActionController::Base" ?

IE:

class ApplicationController < ApplicationController::Base
end

class BaseApplicationController < ApplicationController
end

class UsersController < BaseApplicationController
end

In other words, what is specific motivation for ApplicationController not inheriting from ApplicationController::Base?

Loading the real file is problematic because it will start to grab and preload all sorts of dependencies from your app, causing you to have to restart Spork more often in order for it to see your changes. (additionally, it's not feasible to NOT preload ApplicationController, because rspec-rails WILL, along with all of your ApplicationController's dependencies).

from spork.

timcharper avatar timcharper commented on September 24, 2024

If the above isn't feasible, one possible option would be to create an over-ridable configuration parameter on Spork specifying where the preloadable-bare-bones ApplicationController lies, causing Spork to direct any attempt to load ApplicatonController there rather than it's own stubbish ApplicationController.

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

+1.

Maybe I'm the only one in the world doing this, but I consider this a bug in spork.

Certainly, though, the inheritance scheme could use a module instead of a class.

from spork.

timcharper avatar timcharper commented on September 24, 2024

Taking the premise that this is a bug with Spork, how would you propose to fix it?

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

Not sure - this is why I was asking your advice ;)

As far as I'm concerned, if it isn't a bug in Spork, it's (one of many) gross aspects of rails.

I'm up for moving my code into a module.

from spork.

timcharper avatar timcharper commented on September 24, 2024

I was trying to understand how you arrived at the conclusion that this is a bug in sport.

I would lean towards this being that rails wasn't intended to be used the way spork is using it, so spork has to do some forceful operations to get it to behave. As such, a case could be made that rails has an underlying design flaw.

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

I originally called it a bug in spork because an older version of spork worked fine (that one was preloading ApplicationController, which I consider a nuisance more than anything else).

This version of spork won't work at all unless I first factor my code.

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

BTW: What are you imagining for the parameter idea? Something like this:

http://gist.github.com/799ff78d064b48d2cf30

?

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

Here's a patch:

http://github.com/smtlaissezfaire/spork/tree/application_controller_loading

from spork.

timcharper avatar timcharper commented on September 24, 2024

I believe that won't work because some parts of the rails code base (and rspec-rails too, I believe) explicitly call "require 'application_controller.rb'". The way spork blocks this is by sticking the path with the blank application_controllers to the front of the lib path, satisfying all attempts to "require 'application_controller.rb'", and then later deliberately requiring the application's ApplicationController before the specs are run.

Tim

from spork.

smtlaissezfaire avatar smtlaissezfaire commented on September 24, 2024

Yes - I realized that - which is why I didn't remove the application_helper.rb files, etc.

Sorry if that wasn't obvious from the specs

from spork.

timcharper avatar timcharper commented on September 24, 2024

closing

from spork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.