Skip to content

Instantly share code, notes, and snippets.

module Notable
def self.included(base)
base.has_many :notes, :as => :notable
base.accepts_nested_attributes_for :notes
end
end
class User < ActiveRecord::Base
include Notable
end
# File permissions
run "chmod 755 ."
%w(public log tmp).each do |dir|
run "chmod -R 755 #{dir}"
end
# Remove unnecessary files
%w(README public/index.html public/favicon.ico public/robots.txt).each do |file|
run "rm #{file}"
@stevenhaddox
stevenhaddox / Image.rb
Created May 29, 2009 19:47
Paperclip Polymorphism Issue
class Image < ActiveRecord::Base
# associations
belongs_to :image_attachment, :polymorphic => true
# virtual attributes
attr_accessor :image_styles
def after_initialize
self.image_styles=(set_image_styles)
# set an obvious fake to test param passing works