repository.safe_attributes = params[:repository]
repository.project = project
if repository.save
- render :json => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
+ render :json => {repository.class.name.underscore.tr('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
else
head 422
end
end
def anchor(text)
- text.to_s.gsub(' ', '_')
+ text.to_s.tr(' ', '_')
end
def html_hours(text)
'X-Auto-Response-Suppress' => 'All',
'Auto-Submitted' => 'auto-generated',
'From' => Setting.mail_from,
- 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
+ 'List-Id' => "<#{Setting.mail_from.to_s.tr('@', '.')}>"
# Replaces users with their email addresses
[:to, :cc, :bcc].each do |key|
filters_clauses << sql_for_custom_field(field, operator, v, $1)
elsif field =~ /^cf_(\d+)\.(.+)$/
filters_clauses << sql_for_custom_field_attribute(field, operator, v, $1, $2)
- elsif respond_to?(method = "sql_for_#{field.gsub('.','_')}_field")
+ elsif respond_to?(method = "sql_for_#{field.tr('.','_')}_field")
# specific statement
filters_clauses << send(method, field, operator, v)
else
# Translate attribute names for validation errors display
def self.human_attribute_name(attr, options = {})
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
- class_prefix = name.underscore.gsub('/', '_')
+ class_prefix = name.underscore.tr('/', '_')
redmine_default = [
:"field_#{class_prefix}_#{prepared_attr}",
# the mime type of name
def self.css_class_of(name)
mime = of(name)
- mime && mime.gsub('/', '-')
+ mime && mime.tr('/', '-')
end
def self.main_mimetype_of(name)
cmd_args << "-r#{identifier.to_i}"
cmd_args << bzr_target(path)
scm_cmd(*cmd_args) do |io|
- prefix_utf8 = "#{url}/#{path}".gsub('\\', '/')
+ prefix_utf8 = "#{url}/#{path}".tr('\\', '/')
logger.debug "PREFIX: #{prefix_utf8}"
prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8)
prefix.force_encoding('ASCII-8BIT')