Permalink
Browse files

Fix new migration versions

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9126 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a61b63d commit 3704f4ba2e937e32677d461d54fdaa3172a1df8b @dhh dhh committed Mar 28, 2008
@@ -203,17 +203,19 @@ 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
end
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
@@ -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
@@ -104,20 +104,23 @@ 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.'
task :down => :environment 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
desc 'Rolls the schema back to the previous version. Specify the number of steps with STEP=n'
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.'

0 comments on commit 3704f4b

Please sign in to comment.