Skip to content
Snippets Groups Projects
Commit 817245d9 authored by Clarissa's avatar Clarissa
Browse files

Merge branch 'master' of gitlab.c3sl.ufpr.br:portalmec/portalmec

parents 59e8fb3f 4d58eaa6
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,9 @@ class Institution < ApplicationRecord
#has_many :learning_objects, as: :publisher
#has_many :collections, as: :owner
has_attached_file :avatar, styles: { medium: '300x300>', thumb: '60x60>' }, default_url: ''
validates_attachment_content_type :avatar, content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']
validates_presence_of :name
acts_as_paranoid
......
class InstitutionSerializer < ActiveModel::Serializer
cache key: 'institution', expires_in: 4.hours
attributes :id, :name, :description, :address, :city, :country, :created_at, :updated_at
attributes :id, :name, :description, :address, :city, :country, :avatar, :created_at, :updated_at
end
class AddAttachmentAvatarToInstitutions < ActiveRecord::Migration
def self.up
change_table :institutions do |t|
t.attachment :avatar
end
end
def self.down
remove_attachment :institutions, :avatar
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment