diff options
Diffstat (limited to 'activerecord/lib/active_record')
3 files changed, 10 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 00f986b3ce..2c162a6fc8 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1738,7 +1738,7 @@ MSG end # Returns an <tt>#inspect</tt>-like string for the value of the - # attribute +attr_name+. String attributes are elided after 50 + # attribute +attr_name+. String attributes are truncated upto 50 # characters, and Date and Time attributes are returned in the # <tt>:db</tt> format. Other attributes return the value of # <tt>#inspect</tt> without modification. @@ -2027,15 +2027,18 @@ MSG # If Date bits were not provided, error raise "Missing Parameter" if [1,2,3].any?{|position| !values_hash_from_param.has_key?(position)} max_position = extract_max_param_for_multiparameter_attributes(values_hash_from_param, 6) + # If Date bits were provided but blank, then return nil + return nil if (1..3).any? {|position| values_hash_from_param[position].blank?} + set_values = (1..max_position).collect{|position| values_hash_from_param[position] } - # If Date bits were provided but blank, then default to 1 # If Time bits are not there, then default to 0 - [1,1,1,0,0,0].each_with_index{|v,i| set_values[i] = set_values[i].blank? ? v : set_values[i]} + (3..5).each {|i| set_values[i] = set_values[i].blank? ? 0 : set_values[i]} instantiate_time_object(name, set_values) end def read_date_parameter_value(name, values_hash_from_param) - set_values = (1..3).collect{|position| values_hash_from_param[position].blank? ? 1 : values_hash_from_param[position]} + return nil if (1..3).any? {|position| values_hash_from_param[position].blank?} + set_values = [values_hash_from_param[1], values_hash_from_param[2], values_hash_from_param[3]] begin Date.new(*set_values) rescue ArgumentError # if Date.new raises an exception on an invalid date diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb index ab07253e86..123b3654e6 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb @@ -48,7 +48,7 @@ module ActiveRecord # # Or a URL: # - # ActiverRecord::Base.establish_connection( + # ActiveRecord::Base.establish_connection( # "postgres://myuser:mypass@localhost/somedatabase" # ) # diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 44e5520230..0ee7e20cf1 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -115,7 +115,8 @@ db_namespace = namespace :db do end end else - $stderr.puts "#{config['database']} already exists" + # Bug with 1.9.2 Calling return within begin still executes else + $stderr.puts "#{config['database']} already exists" unless config['adapter'] =~ /sqlite/ end end |