path set by model

rails2
Espen Antonsen 2009-08-10 14:56:56 +02:00
parent 2b9f8b41a8
commit 253e106302
2 changed files with 2 additions and 4 deletions

View File

@ -45,10 +45,8 @@ class AlbumsController < ApplicationController
def create
@album = Album.new(params[:album])
@album.path = @album.title
if @album.save
unless params[:collection_id].empty?
puts "has params"
@album.collections << Collection.find( params[:collection_id] )
end
flash[:notice] = "Album created!"

View File

@ -25,8 +25,8 @@ class Album < ActiveRecord::Base
def ensure_path
self.path = self.title unless self.path
self.path.parameterize
puts self.title.parameterize
self.path = self.title.parameterize unless self.path
end
def set_title