Route Option ArgumentError: wrong number of arguments #810

snowyu opened this Issue Mar 22, 2012 · 3 comments

3 participants

  def self.registered(app)
    app.set(:model) { |subject| condition { load_and_authorize!(subject) } }

and the controller:

  # list/explore the projects
  get :list, :model=>Project do
    render :list

The problem is in:

options.each { |o, a| route.respond_to?(o) ? route.send(o, *a) : send(o, *a) }

Why use *a ? This make the Project load all datas from database, and pass the list to it. And this operation is executed twice!!

Padrino Framework member

Twice because get create also head.

Why *a ?

due to this:

def self.do_this(a, b, c)

get :index, :do_this => [:a, :b, :c]

It expand arrays to be arguments of a method. Isn't this useful ? @nesquena @achiu ?


It's a strange trick, and it'd broken the common usage.

Padrino Framework member

Closing until explained what common usage is broken.

@ujifgc ujifgc closed this Jan 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment