app/models/micropost.rb
#Validates the size of an uploaded picture
#Write a custom function because this validation doesn't correspond
#to build-in Rails validator
Validates the size of an uploaded picture
Write a custom function because this validation doesn't correspond
to build-in Rails validator
Validates the size of an uploaded picture Write a custom function because this validation doesn ' t correspond to build - in Rails validator
def picture_size
  		if picture.size > 5.megabytes
  			errors.add(:picture, "should be less than 5MB")
  		end
  	end
def picture_size if picture . size > 5 . megabytes errors . add ( :picture , "should be less than 5MB" ) end end
Validates the size of an uploaded picture
Write a custom function because this validation doesn't correspond
to build-in Rails validator
Validates the size of an uploaded picture Write a custom function because this validation doesn ' t correspond to build - in Rails validator