0

this is weird, I'm running bundle exec guard on my rails application and I'm getting a long list of errors for every single action in one solitary container. And all the errors are exactly teh same and make no sense, this is what I'm getting for all the actions:

1) PriceProfilesController GET index assigns all price_profiles as @price_profiles
     Failure/Error: Unable to find matching line from backtrace
     ArgumentError:
       wrong number of arguments (1 for 0)
     # ./app/controllers/price_profiles_controller.rb:15:in `extend'

  2) PriceProfilesController GET show assigns the requested price_profile as @price_profile
     Failure/Error: Unable to find matching line from backtrace
     ArgumentError:
       wrong number of arguments (1 for 0)
     # ./app/controllers/price_profiles_controller.rb:15:in `extend'

... and so forth

Any idea whats going on? The PriceProfileContainer is pretty much a standard scaffold. Where should I be looking at here. The spec files are autogenerated by the scaffold.

UPDATE ----

Here is the Extend function in my controller code:

# GET /price_profiles/1/extend
  def extend
    @price_profile = PriceProfile.find(params[:id])
    @products = Product.all()
    @locations = Location.all()
    @price_profile_date_range = PriceProfileDateRange.new()

    #respond_to do |format|
    #  format.html # extend.html.erb      
    #end
  end

Thats pretty much it.

4

1 回答 1

3

extend是一个核心 ruby​​ 方法,允许您将模块的方法添加到对象(有点像包含)

有些东西(你可以通过查看回溯的其余部分来判断)试图在你的控制器的一个实例上调用 extend,期望核心 ruby​​ 的 extend 方法,它需要 1 个参数)而是找到你的 extend 方法,它不带参数(当然做一些完全不同的事情)。

最简单的方法是为您的方法选择一个不同的名称

于 2012-06-03T09:59:40.807 回答