My Rails tutorial (part 1 of 4) has been published in Linux Format 108. It shows you how to build a Rails-powered photo gallery, by using basic techniques and popular plugins.
Grab it from your favourite newsagent and let me know what you think!

My Rails tutorial (part 1 of 4) has been published in Linux Format 108. It shows you how to build a Rails-powered photo gallery, by using basic techniques and popular plugins.
Grab it from your favourite newsagent and let me know what you think!
Phil Melanson
Aug 3
Hi Alex,
I've followed your tuto carefully, with mysql instead of sqlite.
At the end, I've got the following error when trying to upload a new photo: "Size is not included in the list".
It appears in the HTML page in a error message box.
Seems like the size is required, but why?
Everything else is fine and thanks for the great intro to rails.
alex
Aug 3
Phil,
* Give the code a quick check over against the article to ensure you haven't missed anything
* Try a few different images of varying sizes to see if it always happens
* I did a quick search on Google and it seems like some people had this come up when they were developing in Windows: http://railsforum.com/viewtopic.php?id=6307
I tested the gallery in Linux, but not Windows!
Renier
Aug 9
Hi Alex,
Followed your tutorial. I think it was great. Doesn't cease to amaze me how much you can do these days with not a lot of code. I also liked that a photo album was picked for the example, which is so common for people building their own websites.
I did happen upon the same problem Phil reported and I'm on Ubuntu Hardy. Made it go away by adding a param to has_attachment in the Photo model (photo.rb) like this:
class Photo < ActiveRecord::Base
has_attachment :storage => :file_system,
:thumbnails => { :thumb => '160>' },
:content_type => :image,
:size => 0..999999999
validates_as_attachment
belongs_to :user
end
Hackish, but I don't really understand why the error message was coming up in the first place.
Thanks for the tutorial.
alex
Aug 9
Thanks a lot Renier! Now I remember reading something about this bug, I think it might have come about when Rails moved to 2.1.
I found someone else with the solution of specifying the size range on a rails mailing list or forum, so there's obviously a bug somewhere.
Cheers