diff --git a/rails-2.2/app/controllers/settings_controller.rb b/rails-2.2/app/controllers/settings_controller.rb index 99f7bcf08..331f5b5b1 100644 --- a/rails-2.2/app/controllers/settings_controller.rb +++ b/rails-2.2/app/controllers/settings_controller.rb @@ -41,7 +41,7 @@ class SettingsController < ApplicationController @deliveries = ActionMailer::Base.perform_deliveries @guessed_host_and_path = request.host_with_port - @guessed_host_and_path << ('/'+ request.relative_url_root.gsub(%r{^\/}, '')) unless request.relative_url_root.blank? + @guessed_host_and_path << ('/'+ self.class.relative_url_root.gsub(%r{^\/}, '')) unless self.class.relative_url_root.blank? end def plugin diff --git a/rails-2.2/app/helpers/application_helper.rb b/rails-2.2/app/helpers/application_helper.rb index 248704609..2fd263e50 100644 --- a/rails-2.2/app/helpers/application_helper.rb +++ b/rails-2.2/app/helpers/application_helper.rb @@ -372,7 +372,7 @@ module ApplicationHelper if project && (changeset = project.changesets.find_by_revision(oid)) link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid}, :class => 'changeset', - :title => truncate_single_line(changeset.comments, 100)) + :title => truncate_single_line(changeset.comments, :length => 100)) end elsif sep == '#' oid = oid.to_i @@ -381,7 +381,7 @@ module ApplicationHelper if issue = Issue.find_by_id(oid, :include => [:project, :status], :conditions => Project.visible_by(User.current)) link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, :class => (issue.closed? ? 'issue closed' : 'issue'), - :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") + :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") link = content_tag('del', link) if issue.closed? end when 'document' @@ -396,7 +396,7 @@ module ApplicationHelper end when 'message' if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) - link = link_to h(truncate(message.subject, 60)), {:only_path => only_path, + link = link_to h(truncate(message.subject, :length => 60)), {:only_path => only_path, :controller => 'messages', :action => 'show', :board_id => message.board, @@ -423,7 +423,7 @@ module ApplicationHelper if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, :class => 'changeset', - :title => truncate_single_line(changeset.comments, 100) + :title => truncate_single_line(changeset.comments, :length => 100) end when 'source', 'export' if project && project.repository diff --git a/rails-2.2/app/helpers/messages_helper.rb b/rails-2.2/app/helpers/messages_helper.rb index bf23275c3..034d1ad31 100644 --- a/rails-2.2/app/helpers/messages_helper.rb +++ b/rails-2.2/app/helpers/messages_helper.rb @@ -19,7 +19,7 @@ module MessagesHelper def link_to_message(message) return '' unless message - link_to h(truncate(message.subject, 60)), :controller => 'messages', + link_to h(truncate(message.subject, :length => 60)), :controller => 'messages', :action => 'show', :board_id => message.board_id, :id => message.root, diff --git a/rails-2.2/app/helpers/projects_helper.rb b/rails-2.2/app/helpers/projects_helper.rb index cd2e743fe..c759ee5f7 100644 --- a/rails-2.2/app/helpers/projects_helper.rb +++ b/rails-2.2/app/helpers/projects_helper.rb @@ -22,7 +22,7 @@ module ProjectsHelper end def format_activity_title(text) - h(truncate_single_line(text, 100)) + h(truncate_single_line(text, :length => 100)) end def format_activity_day(date) @@ -30,7 +30,7 @@ module ProjectsHelper end def format_activity_description(text) - h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...')) + h(truncate(text.to_s, :length => 250).gsub(%r{<(pre|code)>.*$}m, '...')) end def project_settings_tabs diff --git a/rails-2.2/app/helpers/sort_helper.rb b/rails-2.2/app/helpers/sort_helper.rb index 9ca5c11bd..704361529 100644 --- a/rails-2.2/app/helpers/sort_helper.rb +++ b/rails-2.2/app/helpers/sort_helper.rb @@ -106,7 +106,7 @@ module SortHelper icon = nil order = default_order end - caption = titleize(Inflector::humanize(column)) unless caption + caption = titleize(ActiveSupport::Inflector::humanize(column)) unless caption sort_options = { :sort_key => column, :sort_order => order } # don't reuse params if filters are present @@ -139,7 +139,7 @@ module SortHelper # # def sort_header_tag(column, options = {}) - caption = options.delete(:caption) || titleize(Inflector::humanize(column)) + caption = options.delete(:caption) || titleize(ActiveSupport::Inflector::humanize(column)) default_order = options.delete(:default_order) || 'asc' options[:title]= l(:label_sort_by, "\"#{caption}\"") unless options[:title] content_tag('th', sort_link(column, caption, default_order), options) diff --git a/rails-2.2/app/models/mailer.rb b/rails-2.2/app/models/mailer.rb index 397807d16..5f883b22b 100644 --- a/rails-2.2/app/models/mailer.rb +++ b/rails-2.2/app/models/mailer.rb @@ -186,7 +186,7 @@ class Mailer < ActionMailer::Base # URL options h = Setting.host_name - h = h.to_s.gsub(%r{\/.*$}, '') unless ActionController::AbstractRequest.relative_url_root.blank? + h = h.to_s.gsub(%r{\/.*$}, '') unless ActionController::Base.relative_url_root.blank? default_url_options[:host] = h default_url_options[:protocol] = Setting.protocol @@ -220,7 +220,7 @@ class Mailer < ActionMailer::Base # Renders a message with the corresponding layout def render_message(method_name, body) - layout = method_name.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml' + layout = method_name.to_s.match(%r{text\.html\.(rhtml|rxml)}) ? 'layout.text.html.rhtml' : 'layout.text.plain.rhtml' body[:content_for_layout] = render(:file => method_name, :body => body) ActionView::Base.new(template_root, body, self).render(:file => "mailer/#{layout}", :use_full_path => true) end @@ -239,9 +239,4 @@ class Mailer < ActionMailer::Base end return value end - - # Makes partial rendering work with Rails 1.2 (retro-compatibility) - def self.controller_path - '' - end unless respond_to?('controller_path') end diff --git a/rails-2.2/app/models/user.rb b/rails-2.2/app/models/user.rb index 72c550b82..0fe60571a 100644 --- a/rails-2.2/app/models/user.rb +++ b/rails-2.2/app/models/user.rb @@ -153,7 +153,7 @@ class User < ActiveRecord::Base end def time_zone - @time_zone ||= (self.pref.time_zone.blank? ? nil : TimeZone[self.pref.time_zone]) + @time_zone ||= (self.pref.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.pref.time_zone]) end def wants_comments_in_reverse_order? diff --git a/rails-2.2/app/views/common/_calendar.rhtml b/rails-2.2/app/views/common/_calendar.rhtml index 1095cd501..6ac9ddce6 100644 --- a/rails-2.2/app/views/common/_calendar.rhtml +++ b/rails-2.2/app/views/common/_calendar.rhtml @@ -20,7 +20,7 @@ while day <= calendar.enddt %> image_tag('arrow_to.png') end %> <%= h("#{i.project} -") unless @project && @project == i.project %> - <%= link_to_issue i %>: <%= h(truncate(i.subject, 30)) %> + <%= link_to_issue i %>: <%= h(truncate(i.subject, :length => 30)) %> <%= render_issue_tooltip i %> <% else %> diff --git a/rails-2.2/app/views/common/feed.atom.rxml b/rails-2.2/app/views/common/feed.atom.rxml index 8d07cf208..811140152 100644 --- a/rails-2.2/app/views/common/feed.atom.rxml +++ b/rails-2.2/app/views/common/feed.atom.rxml @@ -1,6 +1,6 @@ xml.instruct! xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do - xml.title truncate_single_line(@title, 100) + xml.title truncate_single_line(@title, :length => 100) xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false})) xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) xml.id url_for(:controller => 'welcome', :only_path => false) @@ -11,9 +11,9 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do xml.entry do url = url_for(item.event_url(:only_path => false)) if @project - xml.title truncate_single_line(item.event_title, 100) + xml.title truncate_single_line(item.event_title, :length => 100) else - xml.title truncate_single_line("#{item.project} - #{item.event_title}", 100) + xml.title truncate_single_line("#{item.project} - #{item.event_title}", :length => 100) end xml.link "rel" => "alternate", "href" => url xml.id url diff --git a/rails-2.2/app/views/documents/_document.rhtml b/rails-2.2/app/views/documents/_document.rhtml index ddfdb9eec..47b450000 100644 --- a/rails-2.2/app/views/documents/_document.rhtml +++ b/rails-2.2/app/views/documents/_document.rhtml @@ -1,3 +1,3 @@
<%= link_to h(document.title), :controller => 'documents', :action => 'show', :id => document %>
-<% unless document.description.blank? %><%=h(truncate(document.description, 250)) %>
<% end %>
+<% unless document.description.blank? %><%=h(truncate(document.description, :length => 250)) %>
<% end %>
<%= format_time(document.created_on) %>
<%= pref_fields.check_box :hide_mail %>
-<%= pref_fields.select :time_zone, TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %>
+<%= pref_fields.select :time_zone, ActiveSupport::TimeZone.all.collect {|z| [ z.to_s, z.name ]}, :include_blank => true %>
<%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %>
<% end %>