Route Option ArgumentError: wrong number of arguments #810

Closed
snowyu opened this Issue Mar 22, 2012 · 3 comments

3 participants

@snowyu
  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
  end

The problem is in:
https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/application/routing.rb#L594

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!!

@DAddYE
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 ?

@snowyu

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

@ujifgc
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