# Photo gallery for each User

**URL:** <https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849>\
**Category:** Rails\
**Created:** [February 21, 2010, 8:20pm UTC](https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849 "2010-02-21T20:20:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 21, 2010, 8:20pm UTC](https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849/1 "2010-02-21T20:20:01Z")

</div>

What is the fastest and easiest way to build a photo gallery for each  
user in my User model? I’d just like to have a very simple gallery for  
each user, perhaps limited to just 5 small photos each to display to  
other users of the site. I’d like to store them in the file system  
instead of the database. No multiple albums needed at this point.  
I’ve found the following two methods. They seem to be old. What’s  
the latest approach on this? Can you recommend any others? Thanks.

1. attachment\_fu  
[http://www.sitepoint.com/forums/showthread.php?t=531644](http://www.sitepoint.com/forums/showthread.php?t=531644)
2. paperclippolymorph  
[Ruby On Rails Polymorphic Paperclip Plugin Tutorial | Burm.net](http://burm.net/2008/10/17/ruby-on-rails-polymorphic-paperclip-plugin-tutorial/)

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 22, 2010, 3:14pm UTC](https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849/2 "2010-02-22T15:14:53Z")

</div>

Or just [GitHub - thoughtbot/paperclip: Easy file attachment management for ActiveRecord](http://github.com/thoughtbot/paperclip)  
Here’s some inspiration for using paperclip to create a photo gallery  
(it  
has many galleries/albums per user though):  
[http://www.joesak.com/2009/09/18/online-photo-gallery-payment-order-fulfillment-ruby-on-rails-tutorial/](http://www.joesak.com/2009/09/18/online-photo-gallery-payment-order-fulfillment-ruby-on-rails-tutorial/)

Lasse

2010/2/21 Ease B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 22, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849/3 "2010-02-22T20:09:20Z")

</div>

Lasse!

Thank you so much. I think I’ll follow that example.

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [March 2, 2010, 9:02pm UTC](https://www.ruby-forum.com/t/photo-gallery-for-each-user/183849/4 "2010-03-02T21:02:28Z")

</div>

Lasse, thank you so much for the pointer. To help the next  
researcher, I am posting this tip. For Rails 2.3.5, when you follow  
Joesak example, you should delete both of the following lines in your  
photo or asset controller:

#session :cookie\_only =\> false, :only =\> :create  
#skip\_before\_filter :verify\_authenticity\_token, :only =\> [‘create’,  
‘destroy’]

Instead, follow the example below to make SWFUpload work with Rails  
session, i.e. to avoid the InvalidAuthenticityToken error:  
[http://github.com/lardawge/swfupload-rails-authentication/tree/paperclip-example](http://github.com/lardawge/swfupload-rails-authentication/tree/paperclip-example).

When you follow the example above, pay attention to the following:

1. Changes in the javascript in the photo views.
2. Changes in session\_store.rb and environment.rb to refer to the app/  
middleware folder, which you should copy from the example.

Good luck and have fun.
