SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Photo Collections

    Hello,

    I am using RoR to build my new personal site. My aim is to have a gallery area to show all my photo albums. I so far, have all my photos pulled from Flickr and I have all my albums showing up on my albums index page.

    I have a Flickr premium account and have sorted all my albums into Collections on Flickr and pulled that data over to my app so know each albums knows it's parent collection or category. They can go up to 3 levels deep.

    I now want to when a user goes to my gallery section on my site to list the top level collections, then when one of those is clicked to show it's sub collections and so on until i get a list of it's albums.

    I am just unsure how to write and develop this part.

    Any thoughts or ideas?

    Neil

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Hi Neil,

    What does your schema look like for the photos?, or are they just static files you've imported?

    You'll need them in the db and to have a resource route to list all collections or all photos under a collection
    resources :collections

    /collections/ -> list top level collections
    /collections/12 -> list all photos in collection 12

    Make sense?

  3. #3
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Mark,

    Thankyou so much for answering my questions.

    Through the process of trying different things out and getting some advice from the RoR irc chatroom I have managed to get all this working last week.

    I ended up having to use a self related model for collections and building a selection of methods to allow me to navigate up and down the hierarchy and get parents and children etc. I then used a nested resource to put albums under collections.

    So my routes are now as follows:

    /collections => See all root collections
    /collections/12 => See collections which are children of collection 12
    /collections/45/albums => See albums which are children of collection 45
    /collections/45/albums/2 = See album 2 of collection 45

    I then added 1 extra route as /albums just to give a gigantic index page of all albums which also works perfectly. Not going to link explicitly to this page but it's there if someone stumbles across it.

    I hope I explained it all ok.

    Kind regards,
    Neil

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Glad you got it sorted out,

    I didn't notice the date of your post, it looks like it's a bit of ghost town in this ROR forum
    I'll come by more often so keep posting your questions

  5. #5
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,891
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it does seem a bit lonely in here. No idea why though as Rails is a great framework. I'm still learning it but over the last few months a lot more if it has clicked into place which is great. Been quite difficult so far due to the fact that before I started I had never seen Ruby code, only done a couple of weeks OO programming in Java, hated using command line tools and had never used a mac in my life!

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,108
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Yes, it does seem a bit lonely in here. No idea why though as Rails is a great framework.
    We just don't have a large Ruby community here, it will naturally grow as more people get across it and there's more people to help each other along.
    I am a huge Rails fan.

  7. #7
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,336
    Mentioned
    192 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I am a huge Rails fan.
    I am huge AND a Rails fan.
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •