Skip to content

Instantly share code, notes, and snippets.

View EdgarOrtegaRamirez's full-sized avatar
📝
​Learning!

Edgar Ortega EdgarOrtegaRamirez

📝
​Learning!
View GitHub Profile
# Hides Draper decorator inside the model and lazily decorates resources
#
# https://gist.github.com/firedev/7a82059b30a2157d4c56
#
# model.rb:
# include Decorated
#
# Just make sure there are no overlapping method names in ModelDecorator
module Decorated
# config/routes.rb
resources :documents do
resources :versions, controller: "documents/versions" do
post :restore, on: :member
end
resource :lock, controller: "documents/locks"
end
class Photo < ActiveRecord::Base
module Statues
QUEUED = 'queued'
NEW = 'new'
def self.values
constants.map(&method(:const_get))
end
# you can define more special methods as you wanted for Statues
end
1. Install and update upstream
//Add remote upstream
git remote add upstream SSH_REMOTE_URI
//Update the new remote that was added
git fetch upstream
//Update your current master with remote upstream/master (the --rebase flag MUST be with the pull action)
git pull --rebase upstream master