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.
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.
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!
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.