#17 ✓resolved
Matt Todd

Controllers or Modules

Reported by Matt Todd | March 7th, 2008 @ 02:31 AM | in Release 0.5.0

Well, the original idea was to have a Halcyon application behave as a single Controller in and of itself, but it appears to be moving towards a more robust structure with the need to separate collections of methods, much like the module ability in 0.4.0 but with much more performance-mindedness and stability...

In this regard, a decision needs to be made, but this decision must be based on experimentation and taste... can we use modules inside of the general Halcyon::Application? Do all actions need to be subclassed anyways? Should routes be defined per-controller?

Just think about these:

class HApp < Halcyon::Application
  route do |r|
    # ...
  end
  def foo; ok; end
  submodule do
    def bar; ok; end
  end
end

This can automatically generate a module that includes the linking module (in order to bind methods unbound from the generated controller).

class HApp < Halcyon::Application
  route do |r|
    # ...
  end
  class Application < Controller
    def foo; ok; end
  end
  class SubModule < Controller
    def bar; ok; end
  end
end

Everything could be under a "controller"...

class HApp < Halcyon::Application
  route do |r|
    # ...
  end
  def foo; ok; end
  module SubModule
    def bar; ok; end
  end
end

Or inside of a module with some magic happening...

A decision must be made. (Do we even need this functionality? Kinda, yeah, I think so, especially if Halcyon is to be RESTful.)

Comments and changes to this ticket

  • Matt Todd

    Matt Todd March 7th, 2008 @ 02:33 AM

    • State changed from “new” to “open”

    This is open for suggestions. Please contribute your thoughts!

  • Matt Todd

    Matt Todd March 26th, 2008 @ 03:36 AM

    • State changed from “open” to “resolved”

    New structure; controllers defined in app/*.rb and inheriting from Application.

    class Foo < Application
      def bar
        ok
      end
    end
    

    0.5.0 will include all of these changes.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages