aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-05-16 23:44:28 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-05-16 23:44:28 +0100
commit17c8cba3a04d715e1063e5adea2b22abce417527 (patch)
treea733a5c24ba1411968e448185a7097be1151e63a
parent0fc3381aa5359f31b36057d7bfba2e0eb6a3c064 (diff)
parent46f30f902fb5e705683dea19ec22179c61e5f208 (diff)
downloadrails-17c8cba3a04d715e1063e5adea2b22abce417527.tar.gz
rails-17c8cba3a04d715e1063e5adea2b22abce417527.tar.bz2
rails-17c8cba3a04d715e1063e5adea2b22abce417527.zip
Merge commit 'mainstream/master'
-rw-r--r--actionpack/lib/action_controller/routing/segments.rb2
-rw-r--r--actionpack/lib/action_view/helpers/text_helper.rb2
-rw-r--r--actionpack/test/controller/routing_test.rb7
-rw-r--r--actionpack/test/template/text_helper_test.rb1
-rw-r--r--activemodel/Rakefile14
-rw-r--r--activerecord/test/cases/named_scope_test.rb4
-rw-r--r--railties/lib/commands/dbconsole.rb3
7 files changed, 27 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb
index b142d18b47..864e068004 100644
--- a/actionpack/lib/action_controller/routing/segments.rb
+++ b/actionpack/lib/action_controller/routing/segments.rb
@@ -249,7 +249,7 @@ module ActionController
end
def extract_value
- "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
+ "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
end
def default
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 9d220c546a..55d2a68327 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -454,7 +454,7 @@ module ActionView
( # leading text
<\w+.*?>| # leading HTML tag, or
[^=!:'"/]| # leading punctuation, or
- ^ # beginning of line
+ | # nothing
)
(
(?:https?://)| # protocol spec, or
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index b28f7bcdff..5e5503fd52 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -50,6 +50,13 @@ class UriReservedCharactersRoutingTest < Test::Unit::TestCase
:additional => ["add#{@segment}itional-1", "add#{@segment}itional-2"] }
assert_equal options, @set.recognize_path("/controller/act#{@escaped}ion/var#{@escaped}iable/add#{@escaped}itional-1/add#{@escaped}itional-2")
end
+
+ def test_route_generation_allows_passing_non_string_values_to_generated_helper
+ assert_equal "/controller/action/variable/1/2", @set.generate(:controller => "controller",
+ :action => "action",
+ :variable => "variable",
+ :additional => [1, 2])
+ end
end
class LegacyRouteSetTests < Test::Unit::TestCase
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 06e1fd1929..337697bf5c 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -262,6 +262,7 @@ class TextHelperTest < ActionView::TestCase
assert_equal email2_result, auto_link(email2_raw)
assert_equal '', auto_link(nil)
assert_equal '', auto_link('')
+ assert_equal "#{link_result} #{link_result} #{link_result}", auto_link("#{link_raw} #{link_raw} #{link_raw}")
end
def test_auto_link_at_eol
diff --git a/activemodel/Rakefile b/activemodel/Rakefile
index cb9a61773f..87e9b547f3 100644
--- a/activemodel/Rakefile
+++ b/activemodel/Rakefile
@@ -1,4 +1,16 @@
#!/usr/bin/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), 'vendor', 'rspec', 'lib')
require 'rake'
-require 'spec/rake/spectask' \ No newline at end of file
+require 'spec/rake/spectask'
+require 'rake/rdoctask'
+
+# Generate the RDoc documentation
+Rake::RDocTask.new { |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "Active Model"
+ rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
+ rdoc.options << '--charset' << 'utf-8'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.rdoc_files.include('README', 'CHANGES')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+} \ No newline at end of file
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index 30c074c9d8..9730f93579 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -6,7 +6,7 @@ require 'models/reply'
require 'models/author'
class NamedScopeTest < ActiveRecord::TestCase
- fixtures :posts, :authors, :topics
+ fixtures :posts, :authors, :topics, :comments
def test_implements_enumerable
assert !Topic.find(:all).empty?
@@ -95,7 +95,7 @@ class NamedScopeTest < ActiveRecord::TestCase
end
def test_has_many_through_associations_have_access_to_named_scopes
- assert_not_equal Comment.containing_the_letter_e, authors(:david).posts
+ assert_not_equal Comment.containing_the_letter_e, authors(:david).comments
assert !Comment.containing_the_letter_e.empty?
assert_equal authors(:david).comments & Comment.containing_the_letter_e, authors(:david).comments.containing_the_letter_e
diff --git a/railties/lib/commands/dbconsole.rb b/railties/lib/commands/dbconsole.rb
index 3e5010c688..b81997aa59 100644
--- a/railties/lib/commands/dbconsole.rb
+++ b/railties/lib/commands/dbconsole.rb
@@ -40,10 +40,11 @@ when "mysql"
exec(find_cmd('mysql5', 'mysql'), *args)
when "postgresql"
+ ENV['PGUSER'] = config["username"] if config["username"]
ENV['PGHOST'] = config["host"] if config["host"]
ENV['PGPORT'] = config["port"].to_s if config["port"]
ENV['PGPASSWORD'] = config["password"].to_s if config["password"]
- exec(find_cmd('psql'), '-U', config["username"], config["database"])
+ exec(find_cmd('psql'), config["database"])
when "sqlite"
exec(find_cmd('sqlite'), config["database"])