path set by model
This commit is contained in:
parent
2b9f8b41a8
commit
253e106302
|
@ -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!"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue