diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-06 18:57:47 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-06 18:57:47 -0300 |
commit | 4e86602e114223adee4d6733695434db5c1bd824 (patch) | |
tree | b3fb607c1ba514c68e6f78090351807736d947e5 | |
parent | ae175a5354321fd64393b9e1f4080437ee3cdf74 (diff) | |
parent | 7f717abb0ed280ba1a1f8abfeeff84bf24cad3e7 (diff) | |
download | rails-4e86602e114223adee4d6733695434db5c1bd824.tar.gz rails-4e86602e114223adee4d6733695434db5c1bd824.tar.bz2 rails-4e86602e114223adee4d6733695434db5c1bd824.zip |
Merge commit 'rails/master'
4 files changed, 5 insertions, 13 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index a47d89ac0e..7a3001174f 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -68,7 +68,7 @@ module ActiveModel # Will add an error message to each of the attributes in +attributes+ that is empty. def add_on_empty(attributes, custom_message = nil) [attributes].flatten.each do |attribute| - value = @base.instance_eval { read_attribute_for_validation(attribute) } + value = @base.send(:read_attribute_for_validation, attribute) is_empty = value.respond_to?(:empty?) ? value.empty? : false add(attribute, :empty, :default => custom_message) unless !value.nil? && !is_empty end @@ -77,7 +77,7 @@ module ActiveModel # Will add an error message to each of the attributes in +attributes+ that is blank (using Object#blank?). def add_on_blank(attributes, custom_message = nil) [attributes].flatten.each do |attribute| - value = @base.instance_eval { read_attribute_for_validation(attribute) } + value = @base.send(:read_attribute_for_validation, attribute) add(attribute, :blank, :default => custom_message) if value.blank? end end @@ -146,7 +146,7 @@ module ActiveModel defaults = defaults.compact.flatten << :"messages.#{message}" key = defaults.shift - value = @base.instance_eval { read_attribute_for_validation(attribute) } + value = @base.send(:read_attribute_for_validation, attribute) options = { :default => defaults, :model => @base.class.name.humanize, diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 0fca96e5cc..7d49e60790 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -66,7 +66,7 @@ module ActiveModel # Declare the validation. send(validation_method(options[:on]), options) do |record| attrs.each do |attr| - value = record.instance_eval { read_attribute_for_validation(attr) } + value = record.send(:read_attribute_for_validation, attr) next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank]) yield record, attr, value end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 24c734cddb..f346e3ebc8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -277,7 +277,6 @@ module ActiveRecord add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key column_sql end - alias to_s :to_sql private @@ -508,7 +507,7 @@ module ActiveRecord # concatenated together. This string can then be prepended and appended to # to generate the final SQL to create the table. def to_sql - @columns * ', ' + @columns.map(&:to_sql) * ', ' end private diff --git a/railties/lib/commands/server.rb b/railties/lib/commands/server.rb index 01dd33fa8c..823916b1dc 100644 --- a/railties/lib/commands/server.rb +++ b/railties/lib/commands/server.rb @@ -3,13 +3,6 @@ require 'action_controller' require 'fileutils' require 'optparse' -# TODO: Push Thin adapter upstream so we don't need worry about requiring it -begin - require_library_or_gem 'thin' -rescue Exception - # Thin not available -end - options = { :Port => 3000, :Host => "0.0.0.0", |