From 7c48fa7a097fdd19f5338a1a1de48e93fb97f95c Mon Sep 17 00:00:00 2001 From: Espen Antonsen Date: Sat, 7 Aug 2010 13:30:53 +0200 Subject: [PATCH] updated so tag listing works. find_by_title instead of id --- app/controllers/photos_controller.rb | 4 ++-- app/helpers/application_helper.rb | 2 +- app/models/tag.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index 60ace09..24e4699 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -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] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1dc2ad5..272c89f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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" diff --git a/app/models/tag.rb b/app/models/tag.rb index cc9e435..36590cd 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -11,7 +11,7 @@ class Tag < ActiveRecord::Base end def to_param - "#{id}-#{title.parameterize}" + title.parameterize end protected