Size is not included in the list

Forums > Book - Chapter 7 > Size is not included in the list

Login to post a new topic

Author Message
maksz
Member since 10 Jan 09:24
0 posts
What does it mean?
I’ve got a ‘size’ field in photos table and I’ve got :max_size => 5.megabytes in has_attachment options in Photo model exactly as in the book.
And trying to upload a photo I’ve got message:
‘1 error prohibited this photo from being saved
There were problems with the following fields:
  • size is not included in the list’
    Can anybody help?
    Thanks,
    Maciek
liam
Member since 10 Feb 01:52
0 posts

I ran into this problem and found out that it is because my local machine was needing to “catch up” with Ruby – so in order to solve it you need to say “wait – hang on a minute – - need to upload a file here” – you do this by adding a “sleep and the number of seconds” line in the def create – as below….
app/Controllers/user_photos_controller.rb
in this section…..add “sleep 5”
def create
@photo = Photo.new(params[:photo])
sleep 5
respond_to do |format|
...........etc etc