No commit activity in last 3 years
No release in over 3 years
Ties durable_decorator to rails and provides a few helpful utility rake tasks that rely on the Rails ENV being loaded into memory
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

 Project Readme

DurableDecoratorRails

This integrates durable_decorator with Rails.

Installation

Add this line to your application's Gemfile:

gem 'durable_decorator_rails', github: 'jumph4x/durable_decorator_rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install durable_decorator_rails

Usage

This gem will generate the correct file structure, place (or append to) the correct decorator and even insert the correct seal for you. Use:

rails g decorator [FULL_METHOD_NAME]

For example, let us decorate the existing #deleted? instance method from the gem that is namespaced under Spree in a file that is a model called Product. Just run:

rails g decorator Spree::Product#deleted?

The gem will create the app/models/spree/product_decorator.rb file for you to start with, and it will have the following contents:

Spree::Product.class_eval do  

  durably_decorate :deleted?, mode: 'strict', sha: '9dc99742ed3ebbdd5b2cbd7c3c93d730e5244e72' do 
  end  

end

Recent versions also pre-populate that with the previous method body, some hellpful comments and a callable alias to the previous version of the method.

Otherwise, you may access the SHA of any method in memory with:

rake durable_decorator:determine_sha[Spree::Product#deleted?]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Cred

A project by Downshift Labs, Ruby on Rails, Performance tuning and Spree Commerce projects.