Hi,
Can anyone tell me how I can pull a full url from an object I just
saved?
I need to send the saved object’s id to my thanks_url so I can build
another object in the thanks_url view.
if @video.save
flash[:notice] = “”
redirect_to thanks_url
else
....
end
Thanks!
-Mario
##FULL CODE
def new_video
@band = Band.find_by_id(params[:band_id])
return unless @band
# fix swfupload ampersand issue
params[:video_data] ||= params['amp;video_data']
# load data from form through swfupload
if params[:video_data]
params[:video] ||= Marshal.load(params[:video_data]) #rescue {}
# move swf's data to the proper key
params[:video][:filename] = params[:Filedata]
end
@video = Video.new(params[:video])
@video.slug = URI.escape(@video.name)
@video.user_id = current_user.id
@video.band = @band
return unless request.post?
unless params[:Filename]
if @video.valid?
@temp = params[:video]
@upload = true
@old_params = {
:video_data => Marshal.dump(params[:video])
}
end
return
end
# Note: swfupload only cares about status code of the response, it
does
# not follow redirections, you will have use it’s callbacks.
if @video.save
flash[:notice] = “”
redirect_to thanks_url
else
raise @video.errors.inspect
render and return false
end
end