Issue 1049 fixed by pre-processing params[:profile][:tags_string] and adding # when required

This commit is contained in:
John Drummond 2011-06-25 23:19:30 -07:00
parent b3556870d3
commit f7abaab276

View file

@ -20,7 +20,15 @@ class ProfilesController < ApplicationController
def update
# upload and set new profile photo
params[:profile] ||= {}
params[:tags] << params[:profile][:tag_string] unless params[:profile][:tag_string].nil?
unless params[:profile][:tag_string].nil?
params[:profile][:tag_string].split( " " ).each do |extra_tag|
extra_tag.strip!
unless extra_tag == ""
extra_tag = "##{extra_tag}" unless extra_tag.start_with?( "#" )
params[:tags] += ",##{extra_tag}"
end
end
end
params[:profile][:tag_string] = (params[:tags]) ? params[:tags].gsub(',',' ') : ""
params[:profile][:searchable] ||= false
params[:profile][:photo] = Photo.where(:author_id => current_user.person.id,