Raj Sharma
Raj Sharma

Reputation: 33

how to extend model of gem file in our ror app

spree/core/app/models/spree/product.rb

This is file that is stored in my gem file. I want to add some functionality to model file, so how to extend gem file in my app.

Upvotes: 0

Views: 378

Answers (1)

Saurabh
Saurabh

Reputation: 1104

You can use decorators. Create a product_decorator.rb in app/models/spree

Spree::Product.class_eval do

  #Place your functionality here
  def some_action
    ...
  end

end

Refer this document. A simple google could have got you this document.

Upvotes: 1

Related Questions