diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index 7569cc381dd2762d76056b1fb7e71f38878ed67e..6b9543c3bea02f3cff21c48bf6bab4731d208fb0 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -203,8 +203,9 @@ def to_tag(options = {}) alias_method :tag_without_error_wrapping, :tag def tag(name, options) - if object.respond_to?("errors") && object.errors.respond_to?("on") - error_wrapping(tag_without_error_wrapping(name, options), object.errors.on(@method_name)) + if object.respond_to?("errors") && object.errors.respond_to?("on") && object.errors.on(@method_name) + # error_wrapping(tag_without_error_wrapping(name, options), object.errors.on(@method_name)) + tag_without_error_wrapping(name, options.merge({ "class" => options["class"] ? "#{options["class"]} errors" : 'errors' })) else tag_without_error_wrapping(name, options) end @@ -212,8 +213,9 @@ def tag(name, options) alias_method :content_tag_without_error_wrapping, :content_tag def content_tag(name, value, options) - if object.respond_to?("errors") && object.errors.respond_to?("on") - error_wrapping(content_tag_without_error_wrapping(name, value, options), object.errors.on(@method_name)) + if object.respond_to?("errors") && object.errors.respond_to?("on") && object.errors.on(@method_name) + # error_wrapping(content_tag_without_error_wrapping(name, value, options), object.errors.on(@method_name)) + content_tag_without_error_wrapping(name, value, options.merge({ "class" => options["class"] ? "#{options["class"]} errors" : 'errors' })) else content_tag_without_error_wrapping(name, value, options) end diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 58374a01adcc52ab6a2269f6cb3aa32367e187a5..4c10cd806c486831e41df070b9cbaa50db6ba2f5 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -343,7 +343,7 @@ def down(migrations_path, target_version = nil) end def run(direction, migrations_path, target_version) - self.new(direction, migrations_path, target_version) + self.new(direction, migrations_path, target_version).run end def schema_info_table_name diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index bd96b233515d8353235ff0e29e842b9dbff9da9c..40b60c19590065cfe838292e00216e7183bf85ab 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -104,6 +104,7 @@ namespace :db do version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil raise "VERSION is required" unless version ActiveRecord::Migrator.run(:up, "db/migrate/", version) + Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end desc 'Runs the "down" for a given migration VERSION.' @@ -111,6 +112,7 @@ namespace :db do version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil raise "VERSION is required" unless version ActiveRecord::Migrator.run(:down, "db/migrate/", version) + Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end end @@ -118,6 +120,7 @@ namespace :db do task :rollback => :environment do step = ENV['STEP'] ? ENV['STEP'].to_i : 1 ActiveRecord::Migrator.rollback('db/migrate/', step) + Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end desc 'Drops and recreates the database from db/schema.rb for the current environment.'