Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

papperclip

  • Loading branch information...
commit 4ae8e2c7011e872d119f90dc091f723b9e0873d5 1 parent c5f2df3
@barthezslavik authored
View
3  Gemfile
@@ -32,6 +32,9 @@ group :development do
end
gem "binding_of_caller"
+gem "jquery-fileupload-rails"
+
+gem "paperclip", "~> 3.0"
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
8 Gemfile.lock
@@ -34,6 +34,7 @@ GEM
erubis (>= 2.7.0)
binding_of_caller (0.6.8)
builder (3.0.4)
+ cocaine (0.4.2)
coderay (1.0.8)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -68,6 +69,12 @@ GEM
mime-types (1.19)
multi_json (1.5.0)
mysql2 (0.3.11)
+ paperclip (3.3.1)
+ activemodel (>= 3.0.0)
+ activerecord (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ cocaine (~> 0.4.0)
+ mime-types
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
@@ -127,6 +134,7 @@ DEPENDENCIES
jquery-fileupload-rails
jquery-rails
mysql2
+ paperclip (~> 3.0)
rails (= 3.2.9)
rb-readline
sass-rails (~> 3.2.3)
View
3  app/models/sample.rb
@@ -1,3 +1,4 @@
class Sample < ActiveRecord::Base
- attr_accessible :description, :name
+ has_attached_file :screenshot, :styles => { :medium => "300x300>", :thumb => "100x100>" }
+ attr_accessible :description, :name, :screenshot
end
View
2  app/views/samples/show.html.haml
@@ -1,7 +1,7 @@
%p#notice= notice
%h2= @sample.name
-%p= @sample.description
+%pre= @sample.description
/= link_to 'Edit', edit_sample_path(@sample)
/= link_to 'Back', samples_path
View
11 db/migrate/20121222111037_add_attachment_screenshot_to_samples.rb
@@ -0,0 +1,11 @@
+class AddAttachmentScreenshotToSamples < ActiveRecord::Migration
+ def self.up
+ change_table :samples do |t|
+ t.has_attached_file :screenshot
+ end
+ end
+
+ def self.down
+ drop_attached_file :samples, :screenshot
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.