- Bug: rails/rails#8928
- Bug: rails/rails#8015
- PR: rails/rails#9756
Fixed ActiveSupport inflector underscore regex
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :posts do |t| |
-if defined?(Bundler) | |
- # If you precompile assets before deploying to production, use this line | |
- Bundler.require *Rails.groups(:assets => %w(development test)) | |
- # If you want your assets lazily compiled in production, use this line | |
- # Bundler.require(:default, :assets, Rails.env) | |
-end | |
+# If you precompile assets before deploying to production, use this line | |
+Bundler.require *Rails.groups(:assets => %w(development test)) | |
+# If you want your assets lazily compiled in production, use this line | |
+# Bundler.require(:default, :assets, Rails.env) |
irb(main):005:0> class Example | |
irb(main):006:1> this_method_does_not_exist | |
irb(main):007:1> end | |
NameError: undefined local variable or method `this_method_does_not_exist' for Example:Class | |
from (irb):6:in `<class:Example>' | |
from (irb):5 | |
from /Users/senny/.rbenv/versions/1.9.3-p385/bin/irb:12:in `<main>' | |
irb(main):008:0> Example | |
=> Example |
draw do | |
get 'get/first', 'get/second', 'get/third', :to => 'get#show' | |
end | |
get '/get/first' | |
assert_equal 'get#show', @response.body | |
get '/get/second' | |
assert_equal 'get#show', @response.body |
Fixed ActiveSupport inflector underscore regex
def assert_template(options = {}, message = nil) | |
# Force body to be read in case the template is being streamed. | |
response.body | |
case options | |
when NilClass, Regexp, String, Symbol | |
options = options.to_s if Symbol === options | |
rendered = @_templates | |
msg = message || sprintf("expecting <%s> but rendering with <%s>", | |
options.inspect, rendered.keys) |
require 'active_record' | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :users do |t| | |
t.timestamps | |
end | |
create_table :activities do |t| | |
t.integer :user_id |
-- MySQL dump 10.13 Distrib 5.5.14, for osx10.7 (i386) | |
-- | |
-- Host: localhost Database: rails-issue-9518_development | |
-- ------------------------------------------------------ | |
-- Server version 5.5.14 | |
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | |
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | |
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | |
/*!40101 SET NAMES utf8 */; |
irb(main):001:0> require 'active_record' | |
:database => ':memory:' ) | |
# Create a database schema to reproduce the bug | |
ActiveRecord::Schema.define do | |
create_table :users | |
create_table :dogs do |t| | |
t.integer :user_id |
THE SCHEMA CHANGES FROM: | |
ActiveRecord::Schema.define(:version => 0) do | |
create_table "my_table", :primary_key => "my_table_id", :force => true do |t| | |
t.integer "col_one" | |
t.string "col_two", :limit => 128, :null => false | |
end | |
end |