In a Rail 3 project I have a script:
<%= javascript_tag do -%>
var columns = new Array();
<% for table in @tables -%>
<% for column in ActiveRecord::Base.const_get(ActiveRecord::Base.class_name(table)).columns -%>
columns.push(new Array('<%= table %>', '<%= column.name %>'));
<% end -%>
<% end -%>
function mergeTableSelected() {
var o = $('select#merge_table option:selected');
$('th select option').remove();
$('th select').each(function(i, select) {
select.options.add(new Option());
$.each(columns, function(j, column) {
if (o.text() == column[0]) {
select.options.add(new Option(column[1]));
}
});
});
}
<% end -%>
After updating from 3.0.0.beta4 to 3.0.0.rc I get:
undefined method `class_name' for ActiveRecord::Base:Class
What to do now?