Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type caster to `RuntimeReflection#alias_name` #28961

merged 1 commit into from May 2, 2017
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -1,3 +1,9 @@
* Add type caster to `RuntimeReflection#alias_name`

Fixes #28959.

*Jon Moss*

* Deprecate `supports_statement_cache?`.

*Ryuta Kamizono*
@@ -1105,7 +1105,7 @@ def alias_candidate(name)

def alias_name, type_caster: klass.type_caster)

def all_includes; yield; end
@@ -1,10 +1,12 @@
require "cases/helper"
require "models/author"
require "models/book"

class EnumTest < ActiveRecord::TestCase
fixtures :books
fixtures :books, :authors

setup do
@author = authors(:david)
@book = books(:awdr)

@@ -55,6 +57,7 @@ class EnumTest < ActiveRecord::TestCase
assert_not_equal @book, Book.where(status: :written).first
assert_equal @book, Book.where(status: [:published]).first
assert_not_equal @book, Book.where(status: [:written]).first
assert_not @author.unpublished_books.include?(@book)
assert_not_equal @book, Book.where.not(status: :published).first
assert_equal @book, Book.where.not(status: :written).first
@@ -106,6 +106,7 @@ def ratings
has_many :tags_with_primary_key, through: :posts

has_many :books
has_many :unpublished_books, -> { where(status: [:proposed, :written]) }, class_name: "Book"
has_many :subscriptions, through: :books
has_many :subscribers, -> { order("subscribers.nick") }, through: :subscriptions
has_many :distinct_subscribers, -> { select("DISTINCT subscribers.*").order("subscribers.nick") }, through: :subscriptions, source: :subscriber
@@ -1,5 +1,5 @@
class Book < ActiveRecord::Base
has_many :authors

This comment has been minimized.

Copy link

rafaelfranca May 2, 2017


Do you need to change the association?

This comment has been minimized.

Copy link

maclover7 May 2, 2017

Author Member

The schema has the _id column on the books table, not authors, versus

I believe I had to change it to get the test passing. Either way the way it is now is wrong

belongs_to :author

has_many :citations, foreign_key: "book1_id"
has_many :references, -> { distinct }, through: :citations, source: :reference_of
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.