Git Product home page Git Product logo

Comments (3)

kristianmandrup avatar kristianmandrup commented on September 12, 2024

Yeah, it doesn't really "fit" the Rails convention, but then again, how could it, when it is designed not to follow the Rails convention? For the same reason, I don't see how the url_for(options) can work?
I think Rails (4.0) needs to be updated to be more flexible with regards to path generation. Perhaps it should be possible to register a Route Mapper that can map any sort of hash (or whatever routing object)?

from focused_controller.

kristianmandrup avatar kristianmandrup commented on September 12, 2024

Hmm, maybe you are right? Every Action is a kind of Controller. So the #run method should set:

params[:controller] = self.class.name and `params[:action] = 'run'``

One hacky way to achieve this (see my fork):

      def run &block
        define_method :run do
           params[:controller] = self.class.name
           params[:action] = 'run'
           instance_eval &block
      end

module PostController
class Show < Action
run do
# run code here!
end
end
end


Not sure however, if this would disrupt the use of the `:to` parameter?

from focused_controller.

jonleighton avatar jonleighton commented on September 12, 2024

I think you shouldn't use params for this. Use the controller_name and action_name methods instead. I've made controller_name work in fb86396.

from focused_controller.

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.