- Bug: rails/rails#8928
- Bug: rails/rails#8015
- PR: rails/rails#9756
Fixed ActiveSupport inflector underscore regex
MyApp::Application.routes.draw do | |
# works mostly but has problems with `url_for :controller => 'module/controller'` | |
resources :posts, :controller => 'Module::Controller' | |
# works | |
resources :articles, :controller => 'module/controller' | |
end |
# Hook to save the html page of every failed scenario into the temp | |
# file directory taht it can be checked after cucumber has finished running. | |
require 'fileutils' | |
require 'capybara/util/save_and_open_page' | |
FAILED_SCENARIO_PAGES_PATH = File.join Rails.root, 'tmp', 'failed_scenarios' | |
FAILED_SCENARIO_IMAGES_PATH = File.join Rails.root, 'tmp', 'failed_scenarios_images' | |
FileUtils.rm_rf FAILED_SCENARIO_PAGES_PATH | |
FileUtils.rm_rf FAILED_SCENARIO_IMAGES_PATH |
class ProductsController < ApplicationController | |
respond_to :html, :xml | |
def index | |
@products = Product.all | |
respond_with @products | |
end | |
def show | |
@product = Product.find(params[:id]) |
» rake routes | |
root GET / pages#home | |
» export CONTROLLER='non-existing-controller' | |
» rake routes | |
» unset CONTROLLER | |
» rake routes | |
root GET / pages#home |
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 |
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 |
-- 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 */; |
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 |
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) |
Fixed ActiveSupport inflector underscore regex