diff --git a/app/models/event.rb b/app/models/event.rb index fbbfb24..4088ee5 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,8 +1,8 @@ class Event < ApplicationRecord belongs_to :profile - validates :name , presence: true - validates :text , presence: true + validates_length_of :name , minimum: 3 , maximum: 100 + validates_length_of :text, minimum: 30 , maximum: 1200 validates :start_date , presence: true validates :picture , presence: true diff --git a/app/models/profile.rb b/app/models/profile.rb index 82f8c53..64e44f3 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -2,9 +2,9 @@ class Profile < ApplicationRecord belongs_to :member has_many :events - validates :name , presence: true + validates_length_of :name , minimum: 3 , maximum: 100 + validates_length_of :bio , minimum: 30 , maximum: 600 validates :kind , presence: true - validates :bio , presence: true validates :picture , presence: true mount_uploader :picture, PictureUploader diff --git a/app/views/members/_profile_card.haml b/app/views/members/_profile_card.haml index 6b8fd99..3048586 100644 --- a/app/views/members/_profile_card.haml +++ b/app/views/members/_profile_card.haml @@ -12,4 +12,4 @@ %h5.m-4.text-3xl.font-bold.text-center = profile.name .mb-8.text-gray-800.text-center - .prose= markdown(profile.bio) + .prose= markdown(shorten(profile.bio))