fird
July 31, 2006, 9:32am
1
#{RAILS_ROOT}/app/controllers/start_controller.rb:13:in `create’
class StartController < ApplicationController
def create
#------------Remove Tag---------------------------
@name = params[:name]
@file = params[:filepath]
@file = @file.gsub !(/^.*(\|/)/, ‘’) # replace html tags with blank
post = Post.save(@params [“removetag”])
end
end
fird
July 31, 2006, 6:09pm
2
The problem is with the ‘!’ in the gsub. That indicates that the
substitution should take place in the original string.
The cleanest solution is to simply remove the “@file =” from the front:
@file.gsub !(/^.*(\|/)/, ‘’) # replace html tags with blank
But you could also remove the ! and keep the variable assignment:
@file = @file.gsub (/^.*(\|/)/, ‘’) # replace html tags with blank
David
[email protected]
fird
July 31, 2006, 8:42pm
3
Then again, if I’d had my first cup of coffee already I’d have noticed
that the REAL problem is that @file is nil, so you’ll need to examine
how @file is set and test for it being set to nil before you do the
gsub.
DOH!
David S. (AFTER first cup of coffee…)
[email protected]