Skip to content

Commit

Permalink
Remove \r before saving contents of config file to db.
Browse files Browse the repository at this point in the history
  • Loading branch information
guanxiaohua2k6 committed May 16, 2012
1 parent c6e2677 commit 7aac162
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/proposals_controller.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -239,15 +239,13 @@ def _change_params


component_config["component_config_default_id"] = ComponentConfigDefault.find_by_path(component_config["path"]).id component_config["component_config_default_id"] = ComponentConfigDefault.find_by_path(component_config["path"]).id
component_config.delete "path" component_config.delete "path"
component_config["content"].gsub! "\r", ""
} }


proposal_hash.fetch("software_configs_attributes", []).each {|index, software_config| proposal_hash.fetch("software_configs_attributes", []).each {|index, software_config|
software_config["software_id"] = proposal_hash["software_id"] software_config["software_id"] = proposal_hash["software_id"]


software_config["software_config_default_id"] = SoftwareConfigDefault.find_by_path(software_config["path"]).id software_config["software_config_default_id"] = SoftwareConfigDefault.find_by_path(software_config["path"]).id
software_config.delete "path" software_config.delete "path"
software_config["content"].gsub! "\r", ""
} }


logger.debug proposal_hash.inspect logger.debug proposal_hash.inspect
Expand Down Expand Up @@ -279,12 +277,14 @@ def _strip_contents_in_params
if params[:proposal].has_key? :software_configs_attributes if params[:proposal].has_key? :software_configs_attributes
params[:proposal][:software_configs_attributes].each do |key, software_config_attr| params[:proposal][:software_configs_attributes].each do |key, software_config_attr|
software_config_attr[:content].strip! software_config_attr[:content].strip!
software_config_attr[:content].gsub! "\r", ""
end end
end end


if params[:proposal].has_key? :component_configs_attributes if params[:proposal].has_key? :component_configs_attributes
params[:proposal][:component_configs_attributes].each do |key, component_config_attr| params[:proposal][:component_configs_attributes].each do |key, component_config_attr|
component_config_attr[:content].strip! component_config_attr[:content].strip!
component_config_attr[:content].gsub! "\r", ""
end end
end end
end end
Expand Down

0 comments on commit 7aac162

Please sign in to comment.