spree-contrib / spree_related_products

Related products extension for Spree Commerce.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
149 stars 241 forks source link

undefined local variable or method `load_object' for #<Admin::ProductsController:0x00000103f962b8> #10

Closed oleksify closed 12 years ago

oleksify commented 13 years ago

Ruby: 1.9.2 Spree: 0.60.1 (0-60-stable branch) This extension ref: bee2e61193a713f8e993d250611a44a962ec7a2b (as on install says)

oleksify commented 13 years ago

Sorry, branch 0.60.1 is working fine (except strange js/css links - need to make admin derectory in public)

ajjahn commented 13 years ago

Care to submit a pull request for the css/js issue?

oleksify commented 13 years ago

On Tue Jul 12 03:11:40 2011, ajjahn wrote:

Care to submit a pull request for the css/js issue?

Will do tomorrow

Awea commented 13 years ago

I have the same problem with spree (0-60-stable) using branch 0.60.1 of related_products (sorry for open/close I am not familiar with github issue system)

cleverlemming commented 13 years ago

I have the same issue with Spree 60.1. "NameError (undefined local variable or method `load_object' for #Admin::ProductsController:0x10c8987a0):"

Commenting out line 32 in spree_related_products.rb seems to fix things. I can't find a "load_object" method in the related products extension, in the 60.1 products_controller.rb or in any of my Spree gems. Is it a legacy from another version?

Admin::ProductsController.class_eval do def related

load_object

      @relation_types = Product.relation_types
    end
  end
octopusinc commented 13 years ago

@cleverlemming Your comment was helpful to me...

Is there a way to override this file or define a local method named load_object? My app runs on Heroku and I can't edit the extension (/lib/spree_related_products.rb#32) directly...

cleverlemming commented 13 years ago

Try adding the appended class to your extension's model directory (see http://guides.spreecommerce.com/logic_customization.html). I just tested it with 60.2 and it works fine.

app/models/products_controller_decorator.rb

Admin::ProductsController.class_eval do def load_object

fix for undefined method load_object in spree_related_products extension

end end

GeekOnCoffee commented 12 years ago

Closing due to age. Feel free to comment if it's still an issue, and we'll reopen.