Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Meaningful Action Params

#36

It could be cool to provide similar behavior to Merb's params by having Halcyon parse each controller's actions and get the param list to automatically provide the appropriate values as params from the params.

For example:

class Foos < Application
  def foo(bar, baz)
    # bar and baz are both set to the values
    # in the params hash.
    bar == params[:bar] #=> true
    baz == params[:baz] #=> true
  end
end

Concerning implementation, this should be cached to prevent constant lookup for static content and to reduce response times as much as possible.

Special considerations: caching this data can be tricky in development mode if class reloading is happening and the class is reloaded. (Might be doable if the Halcyon::Controller class has a class variable set when loaded to the last time it was loaded or to a boolean indicating that it was loaded recently; this way, the action signature hash can be recreated.)

Also, for params not found, nil is sufficient since methods can easily contain default values (that we want to trigger), and may not even be settable from routing (like when other actions call it with special params for specialized behavior).

Reported by Matt Todd · April 30th, 2008 @ 12:29 AM

State: new
Milestone: Release 0.6.0
Assigned to: Matt Todd Matt Todd

Activity

No comments yet.

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.