Permalink
Browse files

Merge branch 'master' of git@github.com:rails/rails

  • Loading branch information...
2 parents 9c4f003 + f32bcee commit 2506e5c9a7d251680f0029d1616f3edb1e3a8db3 @technoweenie technoweenie committed May 31, 2008
View
6 actionpack/lib/action_controller/cgi_ext/cookie.rb
@@ -78,6 +78,12 @@ def to_s
buf
end
+ # FIXME: work around broken 1.8.7 DelegateClass#respond_to?
+ def respond_to?(method, include_private = false)
+ return true if super(method)
+ return __getobj__.respond_to?(method, include_private)
+ end
+
# Parses a raw cookie string into a hash of <tt>cookie-name => cookie-object</tt>
# pairs.
#
View
12 activesupport/lib/active_support/multibyte/chars.rb
@@ -40,13 +40,15 @@ def to_str
# core dumps. Don't go there.
@string
end
-
+
# Make duck-typing with String possible
- def respond_to?(method)
- super || @string.respond_to?(method) || handler.respond_to?(method) ||
- (method.to_s =~ /(.*)!/ && handler.respond_to?($1)) || false
+ def respond_to?(method, include_priv = false)
+ super || @string.respond_to?(method, include_priv) ||
+ handler.respond_to?(method, include_priv) ||
+ (method.to_s =~ /(.*)!/ && handler.respond_to?($1, include_priv)) ||
+ false
end
-
+
# Create a new Chars instance.
def initialize(str)
@string = str.respond_to?(:string) ? str.string : str
View
8 activesupport/lib/active_support/time_with_zone.rb
@@ -248,14 +248,14 @@ def marshal_dump
def marshal_load(variables)
initialize(variables[0], ::Time.send!(:get_zone, variables[1]), variables[2])
end
-
+
# Ensure proxy class responds to all methods that underlying time instance responds to.
- def respond_to?(sym)
+ def respond_to?(sym, include_priv = false)
# consistently respond false to acts_like?(:date), regardless of whether #time is a Time or DateTime
return false if sym.to_s == 'acts_like_date?'
- super || time.respond_to?(sym)
+ super || time.respond_to?(sym, include_priv)
end
-
+
# Send the missing method to +time+ instance, and wrap result in a new TimeWithZone with the existing +time_zone+.
def method_missing(sym, *args, &block)
result = time.__send__(sym, *args, &block)
View
5 railties/environments/environment.rb
@@ -64,7 +64,4 @@
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
-
- # Make ActiveRecord only save the attributes that have changed since the record was loaded.
- # config.active_record.partial_updates = true
-end
+end
View
14 railties/lib/commands/dbconsole.rb
@@ -2,8 +2,13 @@
require 'yaml'
require 'optparse'
+include_password = false
+
OptionParser.new do |opt|
- opt.banner = "Usage: dbconsole [environment]"
+ opt.banner = "Usage: dbconsole [options] [environment]"
+ opt.on("-p", "--include-password", "Automatically provide the database from database.yml") do |v|
+ include_password = true
+ end
opt.parse!(ARGV)
abort opt.to_s unless (0..1).include?(ARGV.size)
end
@@ -31,10 +36,13 @@ def find_cmd(*commands)
'port' => '--port',
'socket' => '--socket',
'username' => '--user',
- 'password' => '--password',
'encoding' => '--default-character-set'
}.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
+ if config['password'] && include_password
+ args << "--password=#{config['password']}"
+ end
+
args << config['database']
exec(find_cmd('mysql5', 'mysql'), *args)
@@ -43,7 +51,7 @@ def find_cmd(*commands)
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"]
+ ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password
exec(find_cmd('psql'), config["database"])
when "sqlite"
View
8 railties/lib/rails_generator/commands.rb
@@ -380,12 +380,14 @@ def render_file(path, options = {})
# Thanks to Florian Gross (flgr).
def raise_class_collision(class_name)
message = <<end_message
- The name '#{class_name}' is reserved by Ruby on Rails.
+ The name '#{class_name}' is either already used in your application or reserved by Ruby on Rails.
Please choose an alternative and run this generator again.
end_message
if suggest = find_synonyms(class_name)
- message << "\n Suggestions: \n\n"
- message << suggest.join("\n")
+ if suggest.any?
+ message << "\n Suggestions: \n\n"
+ message << suggest.join("\n")
+ end
end
raise UsageError, message
end

0 comments on commit 2506e5c

Please sign in to comment.