Skip to content

Commit

Permalink
Merge commit 'rails/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
miloops committed Aug 6, 2009
2 parents ae175a5 + 7f717ab commit 4e86602
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions activemodel/lib/active_model/errors.rb
Expand Up @@ -68,7 +68,7 @@ def add(attribute, message = nil, options = {})
# 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
Expand All @@ -77,7 +77,7 @@ def add_on_empty(attributes, custom_message = nil)
# 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
Expand Down Expand Up @@ -146,7 +146,7 @@ def generate_message(attribute, message = :invalid, options = {})
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,
Expand Down
2 changes: 1 addition & 1 deletion activemodel/lib/active_model/validations.rb
Expand Up @@ -66,7 +66,7 @@ def validates_each(*attrs)
# 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
Expand Down
Expand Up @@ -277,7 +277,6 @@ def to_sql
add_column_options!(column_sql, column_options) unless type.to_sym == :primary_key
column_sql
end
alias to_s :to_sql

private

Expand Down Expand Up @@ -508,7 +507,7 @@ def references(*args)
# 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
Expand Down
7 changes: 0 additions & 7 deletions railties/lib/commands/server.rb
Expand Up @@ -3,13 +3,6 @@
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",
Expand Down

0 comments on commit 4e86602

Please sign in to comment.