using id in params
This commit is contained in:
parent
dde62b43d4
commit
5f16fa8948
|
@ -27,7 +27,7 @@ class AlbumsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@album = Album.find_by_title( params[:id])
|
@album = Album.find( params[:id])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json { render :json => @album }
|
format.json { render :json => @album }
|
||||||
|
|
|
@ -12,7 +12,7 @@ class CollectionsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@collection = Collection.find_by_title( params[:id] )
|
@collection = Collection.find( params[:id] )
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json { render :json => @collection }
|
format.json { render :json => @collection }
|
||||||
|
|
|
@ -16,7 +16,8 @@ class Album < ActiveRecord::Base
|
||||||
named_scope :untouched, :conditions => "Albums.Id IN ( SELECT DISTINCT Photos.Album_Id FROM Photos WHERE Photos.description IS NULL AND Photos.Id NOT IN ( SELECT Photo_ID FROM Photo_Tags) )"
|
named_scope :untouched, :conditions => "Albums.Id IN ( SELECT DISTINCT Photos.Album_Id FROM Photos WHERE Photos.description IS NULL AND Photos.Id NOT IN ( SELECT Photo_ID FROM Photo_Tags) )"
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
title.gsub(/[^a-z0-9]+/i, '-')
|
"#{id}-#{title.parameterize}"
|
||||||
|
#self.title.gsub(/[^a-z0-9]+/i, '-')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ class Collection < ActiveRecord::Base
|
||||||
attr_accessor :album_list
|
attr_accessor :album_list
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
title.gsub(/[^a-z0-9]+/i, '-')
|
#title.gsub(/[^a-z0-9]+/i, '-')
|
||||||
|
"#{id}-#{title.parameterize}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def album_list=(albums)
|
def album_list=(albums)
|
||||||
|
|
Loading…
Reference in a new issue