diff --git a/app/models/learning_object.rb b/app/models/learning_object.rb index 4fd0dba74bf856404b7e25f5e613da2547ae5085..3b83ebe29fedfd4ec88596e47bf30c678468fcf3 100644 --- a/app/models/learning_object.rb +++ b/app/models/learning_object.rb @@ -4,6 +4,8 @@ class LearningObject < ActiveRecord::Base include Sociable include Stateful + has_attached_file :thumbnail, styles: {medium: "530x300", small: "250x140"} + has_and_belongs_to_many :topics has_many :collection_items, as: :collectionable diff --git a/db/migrate/20160219132305_remove_string_thumbnail.rb b/db/migrate/20160219132305_remove_string_thumbnail.rb new file mode 100644 index 0000000000000000000000000000000000000000..d71a04b00a271f5c9efb03cae32d450ae581e44a --- /dev/null +++ b/db/migrate/20160219132305_remove_string_thumbnail.rb @@ -0,0 +1,5 @@ +class RemoveStringThumbnail < ActiveRecord::Migration + def change + remove_column :learning_objects, :thumbnail, :string + end +end diff --git a/db/migrate/20160219132533_add_paperclip_thumbnail.rb b/db/migrate/20160219132533_add_paperclip_thumbnail.rb new file mode 100644 index 0000000000000000000000000000000000000000..bbc498136b4a5bbece69b5fba43c5a43b381ee9f --- /dev/null +++ b/db/migrate/20160219132533_add_paperclip_thumbnail.rb @@ -0,0 +1,9 @@ +class AddPaperclipThumbnail < ActiveRecord::Migration + def up + add_attachment :learning_objects, :thumbnail + end + + def down + remove_attachment :learning_objects, :thumbnail + end +end