Chapter 13. Photo Gallery

Photo Gallery is the second of three complete Rails applications in this book, each designed to demonstrate different real-world techniques for building Ajax applications in Rails, from start to finish.

In Example A, the Review Quiz application was primarily textual. So this time, the focus will be more graphical. We’ll look at an implementation of Ajax file upload, in-place-editing, encapsulating client-side behavior in custom JavaScript objects, and of course, RJS.

The application is a simple photo gallery and is a simple way to organize and browse collections of images, as shown in Figure B-1. Ajax is used to make the uploading process smooth and to display full-size images inline with the thumbnails view.

Gallery home page
Figure 13-1. Gallery home page

To download the source to this application, rails gallery, visit http://www.oreilly.com/catalog/9780596527440. Where files aren’t listed they are the same as the Rails default skeleton. Once the files are in the correct place, you’ll need to configure a database by editing config/database.yml. The default configuration as generated by rails gallery expects a MySQL database named gallery_development, accessible at localhost with the username root and no password. To get started, create a database for the application and change database.yml as needed, then run rake db:schema:load to create the application’s database structure, ...

Get Ajax on Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.