updated so tag listing works. find_by_title instead of id

This commit is contained in:
Espen Antonsen 2010-08-07 13:30:53 +02:00
parent c049033193
commit 670c7dad5e
3 changed files with 4 additions and 4 deletions

View file

@ -5,9 +5,9 @@ class PhotosController < ApplicationController
def index
if params[:tag_id] && params[:album_id]
@photos = Tag.find( params[:tag_id] ).photos.find(:all, :conditions => ['photos.album_id = :album', {:album => Album.find(params[:album_id] ) } ], :order => "photos.id ASC")
@photos = Tag.find_by_title( params[:tag_id] ).photos.find(:all, :conditions => ['photos.album_id = :album', {:album => Album.find(params[:album_id] ) } ], :order => "photos.id ASC")
elsif params[:tag_id]
@photos = Tag.find( params[:tag_id] ).photos.find(:all, :order => "photos.id ASC")
@photos = Tag.find_by_title( params[:tag_id] ).photos.find(:all, :order => "photos.id ASC")
elsif params[:album_id]
@photos = Album.find( params[:album_id]).photos.find(:all, :order => "photos.id ASC")
elsif params[:q]

View file

@ -8,7 +8,7 @@ module ApplicationHelper
#links = "You are here: "
links = content_tag('a', "HOME", :href => "/") if include_home
nocrumb = ["collections", "albums", "photos", "tags", "new", "edit"]
nocrumb = ["collections", "albums", "photos", "tags", "new", "edit", "tags"]
levels.each_with_index do |level, index|
level = level.gsub(/^[0-9]+\-/,"") #if levels[index-1] == "photos"

View file

@ -11,7 +11,7 @@ class Tag < ActiveRecord::Base
end
def to_param
"#{id}-#{title.parameterize}"
title.parameterize
end
protected