Skip to content

Instantly share code, notes, and snippets.

@DixcomWeb
DixcomWeb / pages_controller.rb
Created April 18, 2012 11:54 — forked from patrickberkeley/pages_controller.rb
using Paperclip for multiple attachments and displaying them using the method described in Advanced Rails Recipe #13
class PagesController < ApplicationController
before_filter :login_required, :except => [ :show ]
# GET /pages
# GET /pages.xml
def index
@pages = Page.find(:all)
respond_to do |format|
format.html # index.html.erb
@DixcomWeb
DixcomWeb / confident.rb
Created May 21, 2011 16:40 — forked from afair/confident.rb
Notes on Advi Grimm's "Confident Code" talk
# http://avdi.org/talks/confident-code-2010-01-12/confident-code.html
# Narrative structure: Four Parts
#==========================================================
# Gather input:
# Coerce
param.to_s #to_i #to_sym Array() ... use liberally!
messages = Array(messages)
# Decorators
.DS_Store
*.csv
*.pdf
gem 'sunspot_rails', :require => 'sunspot/rails'
# ...
namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundle')
release_dir = File.join(current_release, '.bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do