Skip to content

Instantly share code, notes, and snippets.

View fellix's full-sized avatar

Rafael Felix fellix

View GitHub Profile
@sobrinho
sobrinho / track_habtm_changes.rb
Last active December 21, 2015 12:58
Track habtm changes on active record
# See https://groups.google.com/forum/#!topic/rubyonrails-core/Lb9rBkZnZSo
module TrackHabtmChanges
def self.included(model)
model.after_initialize :track_habtm_initial_state
model.after_save :track_habtm_initial_state
end
def changes
super.merge(habtm_changes)
end
@maccman
maccman / juggernaut_heroku.md
Created June 2, 2011 01:26
Juggernaut on Heroku

Clone repo:

git clone git://github.com/maccman/juggernaut.git
cd juggernaut

Create Heroku app:

heroku create myapp --stack cedar
heroku addons:add redistogo:nano

git push heroku master

@ches
ches / gist:243611
Created November 26, 2009 19:09 — forked from lukesutton/gist:107966
basic example of Warden authentication with Sinatra
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end