rctneil — 2012-05-12T06:53:05-04:00 — #1
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?
markbrown4 — 2012-05-26T10:21:05-04:00 — #2
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
/collections/ -> list top level collections
/collections/12 -> list all photos in collection 12
rctneil — 2012-05-26T12:05:18-04:00 — #3
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.
markbrown4 — 2012-05-26T19:51:26-04:00 — #4
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
rctneil — 2012-05-28T14:17:56-04:00 — #5
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!
markbrown4 — 2012-05-28T19:46:02-04:00 — #6
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.
parkint — 2012-05-30T15:56:51-04:00 — #7
I am huge AND a Rails fan. :goof:
mittineague — 2014-09-18T21:10:55-04:00 — #8
This topic is now archived. It is frozen and cannot be changed in any way.