ruby on rails - How to add a new method to ProductsController in spree -


i want add method called quick_view, show method simpler , meant served ajax on hover on product.

how can achieve ? how can open productscontroller of spree , add before_filters , specify appropriate routes..

thanks !

doco @ https://guides.spreecommerce.com/developer/logic.html

create class called app/controllers/products_controller_decorator.rb, , put in it:

spree::productscontroller.class_eval    before_filter :my_filter, :only => :quick_view    def quick_view     # code goes here   end    private     def my_filter       # code before filter goes here     end  end 

as routes, you'll able add in routes.rb file other route, you'll need specify it's spree route:

spree::core::engine.routes.draw   # route goes inside block end 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -