drhenner / ror_ecommerce

Ruby on Rails Ecommerce platform, perfect for your small business solution.
www.ror-e.com
MIT License
1.21k stars 409 forks source link

NoMethodError (undefined method `[]' for nil:NilClass) when trying to create new Product #191

Closed drakon8888 closed 6 years ago

drakon8888 commented 6 years ago

Hello. I'm trying to create a simple Demo application in local environment with your awesome framework that was chosen by my customer. I've initialised it according to your manual, it works fine except SOLR searching engine. When I'm trying to create a new Product from admin panel I'm always getting an error - NoMethodError (undefined method []' for nil:NilClass). I'm fulfilling all the fields, pushing it, it's already creating a product without errors and it's Rollbacking after SOLR query. I debugged the application and found that it issued by this callback perform_index_tasks while trying to save the Product. But didn't found the reason. I guess it needs some settings. I've spent a lot of hours without result and didn't found the same problem in Google :-( here is my SOLR config solr:

hostname: localhost port: 8982 log_level: INFO path: /solr/development

Here is info from console at this error SQL (0.7ms) INSERT INTO 'products' ('name', 'product_keywords', 'product_type_id', 'prototype_id', 'shipping_category_id', 'permalink', 'deleted_at', 'meta_keywords', 'meta_description', 'created_at', 'updated_at', 'brand_id') VALUES ('shirt 5', ' shirt', 2, 1, 1, 'shirt_my', '2018-01-24 22:25:59', 'shirt', 'shirt', '2018-01-24 22:25:59', '2018-01-24 22:25:59', 1) (13.5ms) COMMIT SOLR Request (7.3ms) [ path=update parameters={} ] ROLLBACK Completed 500 Internal Server Error in 359ms (ActiveRecord: 37.5ms)

I hope maybe you could help me please. I will be appreciate that.

drhenner commented 6 years ago

I'll try to get a few minutes this weekend to check this out.

History => I had to make solr optional for ror_ecommerce because several people didn't want to go through the trouble of setting it up. The gem probably needs several upgrades and possibly more to get everything squared away.

I'm really sorry you're running into issues. The more info you can send to me with full stack traces the better I can help. I'll do my best to get this resolved ASAP.

drakon8888 commented 6 years ago

Hi, David. Thank you for quick response. I found and resolved the problem by myself. It was related with Solr gem version. It was fixed in Gem file, and when I've updated sunspot_solr from 2.0.0 to 2.2.7, the problem has gone! Just reinstalled it.