public
Description: Merb More: The Full Stack. Take what you need; leave what you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-more.git
Andy Delcambre (author)
Mon May 12 12:36:51 -0700 2008
michaelklishin (committer)
Wed May 14 08:01:52 -0700 2008
commit  80e5040521fdd3dfe209f459373521d3c57550a2
tree    3147d71e2ed88a61bbc18937132f746d22310762
parent  0c825f720f8e153432aae88acc4205702effacfe
merb-more / merb-action-args
name age message
..
file LICENSE Wed Feb 06 17:34:05 -0800 2008 Action Args [Yehuda Katz]
file README Wed Feb 06 17:34:05 -0800 2008 Action Args [Yehuda Katz]
file Rakefile Fri May 09 15:50:59 -0700 2008 Bump version to 0.9.4. [michaelklishin]
file TODO Wed Feb 06 17:34:05 -0800 2008 Action Args [Yehuda Katz]
directory lib/ Wed May 14 08:01:52 -0700 2008 ActionArgs can now eval to false [Andy Delcambre]
directory spec/ Wed May 14 08:01:52 -0700 2008 ActionArgs can now eval to false [Andy Delcambre]
README
merb-action-args
================

A plugin for the Merb framework that provides support for arguments to actions that 
come in from the query.

==== Basics

{{[
class Foo < Merb::Controller
  def bar(baz)
    bar
  end
end
]}}

Hitting "/foo/bar?baz=bat" will call foo("bat").

Hitting "/foo/bar" will raise a BadRequest (Status 400) error.

==== Defaults

{{[
class Foo < Merb::Controller
  def bar(baz, bat = "hola")
    "#{baz} #{bat}"
  end
end
]}}

Hitting "/foo/bar?baz=bat" will call foo("bat", "hola")

Hitting "/foo/bar?baz=bat&bat=whaa" will call foo("bat", "whaa")

Hitting "/foo/bar" will still raise a BadRequest.

==== Out of order defaults

{{[
class Foo < Merb::Controller
  def bar(one, two = "dos", three = "tres")
    "#{one} #{two} #{three}"
  end
end
]}}

The interesting thing here is that hitting "/foo/bar?one=uno&three=three" will call
foo("uno", "dos", "three"). In other words, the defaults can be in any order, and 
merb-action-args will figure out where to fill in the holes.