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

The :source option for has_many => through should accept String values. #14668

Merged

Conversation

@laurocaetano
Copy link
Contributor

@laurocaetano laurocaetano commented Apr 9, 2014

With the changes introduced by 16b70fd it was expecting the value to be a Symbol, while it could also be a String value.

The solution was call to_sym on the given :source.

Fixes #14651

This PR should only be backported to 4-1-stable

@@ -481,7 +481,7 @@ class ThroughReflection < AssociationReflection #:nodoc:

def initialize(macro, name, scope, options, active_record)
super
@source_reflection_name = options[:source]
@source_reflection_name = options[:source] ? options[:source].to_sym : options[:source]
Copy link
Member

@rafaelfranca rafaelfranca Apr 9, 2014

can we do this inside source_reflection_name method?

values.

With the changes introduced by 16b70fd
it was expecting the value to be a Symbol, while it could be also a
String value.
@laurocaetano
Copy link
Contributor Author

@laurocaetano laurocaetano commented Apr 9, 2014

@rafaelfranca updated, what do you think?

@tenderlove
Copy link
Member

@tenderlove tenderlove commented Apr 9, 2014

I'd prefer all the caches internally use strings. What breaks when they use a string?

tenderlove added a commit that referenced this issue Apr 9, 2014
…_value

The :source option for has_many => through should accept String values.
@tenderlove tenderlove merged commit 1368311 into rails:master Apr 9, 2014
tenderlove added a commit that referenced this issue Apr 9, 2014
…_value

The :source option for has_many => through should accept String values.
laurocaetano added a commit to laurocaetano/rails that referenced this issue Apr 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants