Skip to content

Instantly share code, notes, and snippets.

View mickey's full-sized avatar

Michael Bensoussan mickey

View GitHub Profile
class Activity < ActiveRecord::Base
belongs_to :user
belongs_to :target, :polymorphic => true
default_scope :order => 'activities.created_at DESC', :limit => 10
AUDITION_POSTED = 1 #target --> model audition
AUDITION_FEEDBACK_UPDATED = 2 #target --> model audition
AUDITION_VIEWED = 3 #target --> model video
NEW_PART = 4 #target --> model part
class CreateActivities < ActiveRecord::Migration
def self.up
create_table :activities do |t|
t.integer :user_id, :null => false
t.integer :activity_type, :null => false
t.integer :target_id, :null => false
t.string :target_type, :null => false
t.timestamps
end
- if local_assigns[:show_ad]
= render partial: 'ad'
= render partial: 'user/new'
= render partial: 'user/new', locals: { show_ad: true }
upstream yoursite {
server yoursite1.yoursite.com max_fails=3;
server yoursite2.yoursite.com max_fails=3;
server yoursite3.yoursite.com backup;
}
upstream yoursite {
server yoursite1.yoursite.com;
server yoursite2.yoursite.com max_fails=3 fail_timeout=30s;
}
upstream yoursite {
server yoursite1.yoursite.com weight=4;
server yoursite2.yoursite.com;
}
upstream yoursite {
ip_hash;
server yoursite1.yoursite.com down;
server yoursite2.yoursite.com;
}
upstream yoursite {
ip_hash;
server yoursite1.yoursite.com;
server yoursite2.yoursite.com;
}
upstream yoursite {
server yoursite1.yoursite.com;
server yoursite2.yoursite.com;
}
server {
server_name www.yoursite.com;
location / {
proxy_pass http://yoursite;
}