Quantcast
Channel: zeroturnaround.com » All Posts
Viewing all articles
Browse latest Browse all 2540

Reply To: JRebel not breaks our app after JRuby version upgrade

$
0
0

The JVM flag did not help, still got the same error. The only thing we upgraded was JRuby AFAIK. environment.rb contents:

require File.expand_path(‘../../lib/j’, __FILE__)
# Load the rails application
require File.expand_path(‘../application’, __FILE__)
# Monkey patches that need be loaded just once
# Please don’t add to lib/monkeypatches.rb; rather create named
# patches in lib/patches. They will be autoloaded.
require File.expand_path(‘../../lib/monkeypatches’, __FILE__)
RentalExpress::Application.initialize!

module ActiveRecord::ConnectionAdapters::SchemaStatements
alias_method :create_table_without_onsite_defaults, :create_table

# Add :options => “IN onsite_data INDEX IN onsite_indexes” to the
# options hash when creating a table, unless :no_onsite_options is
# true, or unless :options is already specified.
def create_table_with_onsite_defaults(table_name, options = {}, &block)
unless options[:no_onsite_options]
options[:options] = “IN onsite_data_4k INDEX IN indexes_new” unless options[:options]
end

create_table_without_onsite_defaults table_name, options, &block
unless options[:no_grant]
execute “GRANT SELECT, INSERT, UPDATE, DELETE on #{table_name} TO USER ONSITE”
end
end

alias_method :create_table, :create_table_with_onsite_defaults
end

class ActiveRecord::Migration
def self.jdbc_connection
unless connection.respond_to? :jdbc_connection
connection.class.send(:define_method, :jdbc_connection) { @connection }
end

connection.jdbc_connection
end

def self.reorg(tablename, options=nil)
puts “REORG TABLE #{tablename}#{” #{options}” if options};”
connection.send :reorg_table, tablename, options
end

def self.runstats(tablename, priority=10)
puts “RUNSTATS ON TABLE #{tablename} WITH DISTRIBUTION AND DETAILED INDEXES ALL UTIL_IMPACT_PRIORITY #{priority};”
runstats_for_table(tablename, priority)
end

def reorg(tablename, options=nil)
self.class.reorg(tablename, options)
end

def runstats(tablename, priority=10)
self.class.runstats(tablename, priority)
end
end

# Turning off a feature we don’t use (storing the full module name in Single
# Table Inheritance ActiveRecords classes) to prevent an issue with modularized
# ActiveRecord classes that aren’t STI. STI can still be used, just not across
# multiple modules.
#
# This is to fix up a bug we were experiencing in a non-STI model with the
# Rails 2.2.2 logic for STI handling.
ActiveRecord::Base.store_full_sti_class = false

Date::DATE_FORMATS[:mdy] = “%m/%d/%Y”
Time::DATE_FORMATS[:mdy] = “%m/%d/%Y %H:%M”


Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>