Topic: Where do I do this?

Hey guys,

I'm working on a small custom admin panel for my own personal website. I am working on the part to allow me to manage my Flickr photographs

I have a Flickr class which contains methods to get the list of sets from Flickr, the photos in a particular set and another to grab the sizes for a particular photo.

What I want to do is grab a list of all the sets - (which I can get via a method in my Flickr class) but then for each set that is returned, look through my local Albums (what I call sets on my site) DB table to see if that sets id is in my table and then put a tick or cross next to each set name in the admin panel highlighting if I have that set on my site or not.

So, I know what I wish to do but I am just not 100% sure where to put this logic of looping through the set list returned from Flickr.

Is anyone able to help guide me here?

Kind regards,

Re: Where do I do this?

You should put business logic in models.
So set up a boolean method in your set class that worksd out whther or not you have the album locally then when you iterate through the array of set recirds in your view you can just supply a graphic in the form of a check box or a cross depending on the result of the method.

In other words use your models to work out an answer and your views can choose to show something depending on the answer given.
In coding terms

class Set < ....
  def is_local?
    #Some calculation to work out if set is stored locally

then in your view

<% if set.is_local? %>
  <!-- Do something -->

Hope that makes sense

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)