This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/routes.rb | |
resources :documents do | |
resources :versions, controller: "documents/versions" do | |
post :restore, on: :member | |
end | |
resource :lock, controller: "documents/locks" | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |