class Asset < ActiveRecord::Base has_friendly_id :title, :use_slug => true, :cache_column => :permalink acts_as_taggable_on :tags, :categories acts_as_joinable has_attached_file :data, :styles => { :medium => "300x300>", :thumb => "120x120#", :tiny => "50x50#", :micro => "20x20#" }, :storage => :s3, :s3_credentials => { :access_key_id => Settings("s3.key"), :secret_access_key => Settings("s3.secret") }, :path => Settings("s3.permalink"), :bucket => Settings("s3.bucket") def url(style = nil) data.url(style || data.default_style) end end