Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rails/rails
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed May 31, 2008
2 parents 9c4f003 + f32bcee commit 2506e5c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
6 changes: 6 additions & 0 deletions actionpack/lib/action_controller/cgi_ext/cookie.rb
Expand Up @@ -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.
#
Expand Down
12 changes: 7 additions & 5 deletions activesupport/lib/active_support/multibyte/chars.rb
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions activesupport/lib/active_support/time_with_zone.rb
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions railties/environments/environment.rb
Expand Up @@ -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
14 changes: 11 additions & 3 deletions railties/lib/commands/dbconsole.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions railties/lib/rails_generator/commands.rb
Expand Up @@ -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
Expand Down

0 comments on commit 2506e5c

Please sign in to comment.