Another 2 newbie questions

Hey all,
Ok I have three tables:
Images(id,name,dirid) #dirid is a foreign key to Album.url, the path
to the image
Albums(id,url)
Tags(id,name)
ImagesTags(image_id,tag_id)

I have a HABTM relation for tags and images and a belongs_to/has_many
relation for albums and images.
Now in my views/tag/show.rhtml I have this:
<% for album in @albums %>
<% for image in @images %>
<% if @tag.images.include? image %>

<%=
show_image album.url+’/’+image.name %>
<% end %>
<% end %>

The problem is that this displays all the albums url including those
that are not listed as foreign key so it displays images that don’t
exist ie dead links. Any idea how I could display the url of each
images and not all urls?

Second question:
I would like to use some ajax in the way to display the images.
something like

<% if @tag.images.include? image %>
<%= show_image album.url+'/'+image.name %>

and in the <% for image in @images %> include some kind of
:action=>blind_down just like in the flickr demo screen cast so that
the div just blind down when images are loaded. I included all the
scriptaculous.js in my /public/javascripts so all the necessary stuff
should be there.

thanx in advance

Pat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs